From 0f9f085fd5d9014712d818e1c05d2de44a322063 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 May 2025 07:57:40 +0000 Subject: [PATCH] CodeGen from PR 34238 in Azure/azure-rest-api-specs Merge 5b41d6fca6a5d0ab6420d2b567d83f0704ff12f5 into 37a849b656ecfb33424822b9f245aebff2ae994f --- .../Samples/Sample_AddressResource.cs | 107 + .../Sample_AddressResourceCollection.cs | 187 ++ .../Samples/Sample_OrderItemResource.cs | 162 + .../Sample_OrderItemResourceCollection.cs | 188 ++ .../Generated/Samples/Sample_OrderResource.cs | 49 + .../Samples/Sample_OrderResourceCollection.cs | 125 + .../Sample_ResourceGroupResourceExtensions.cs | 14 +- .../Sample_SubscriptionResourceExtensions.cs | 97 +- .../AddressResource.Serialization.cs | 26 + ...rAddressResource.cs => AddressResource.cs} | 226 +- ...ection.cs => AddressResourceCollection.cs} | 194 +- ...s => AddressResourceData.Serialization.cs} | 93 +- ...rAddressData.cs => AddressResourceData.cs} | 35 +- .../src/Generated/ArmEdgeOrderModelFactory.cs | 893 +++--- .../EdgeOrderAddressResource.Serialization.cs | 26 - .../EdgeOrderItemResource.Serialization.cs | 26 - .../EdgeOrderResource.Serialization.cs | 26 - .../Extensions/EdgeOrderExtensions.cs | 474 +-- .../Extensions/MockableEdgeOrderArmClient.cs | 36 +- .../MockableEdgeOrderResourceGroupResource.cs | 182 +- .../MockableEdgeOrderSubscriptionResource.cs | 306 +- .../AddressResourceOperationSource.cs | 36 + .../EdgeOrderAddressOperationSource.cs | 36 - .../EdgeOrderItemOperationSource.cs | 36 - .../OkResponseOperationSource.cs | 30 + .../OrderItemResourceOperationSource.cs | 36 + .../src/Generated/Models/ActionStatusEnum.cs | 51 + .../AdditionalConfiguration.Serialization.cs | 159 + .../Models/AdditionalConfiguration.cs | 86 + .../Generated/Models/AddressClassification.cs | 51 + ...ion.cs => AddressDetails.Serialization.cs} | 46 +- ...temAddressDetails.cs => AddressDetails.cs} | 24 +- .../Models/AddressProperties.Serialization.cs | 199 ++ ...ressProperties.cs => AddressProperties.cs} | 34 +- .../AddressResourceList.Serialization.cs | 24 +- .../Generated/Models/AddressResourceList.cs | 25 +- ... => AddressResourcePatch.Serialization.cs} | 46 +- ...ddressPatch.cs => AddressResourcePatch.cs} | 22 +- .../src/Generated/Models/AddressType.cs | 54 + .../Models/AddressValidationStatus.cs | 54 + .../Models/AutoProvisioningStatus.cs | 51 + ... AvailabilityInformation.Serialization.cs} | 46 +- ...ormation.cs => AvailabilityInformation.cs} | 18 +- .../src/Generated/Models/AvailabilityStage.cs | 66 + ...s => BillingMeterDetails.Serialization.cs} | 67 +- ...MeterDetails.cs => BillingMeterDetails.cs} | 26 +- ...cs => CancellationReason.Serialization.cs} | 38 +- ...llationReason.cs => CancellationReason.cs} | 14 +- .../CategoryInformation.Serialization.cs | 176 ++ .../Generated/Models/CategoryInformation.cs | 78 + .../src/Generated/Models/ChargingType.cs | 51 + .../ChildConfiguration.Serialization.cs | 478 +++ .../Generated/Models/ChildConfiguration.cs | 139 + .../ChildConfigurationFilter.Serialization.cs | 168 + .../Models/ChildConfigurationFilter.cs | 71 + .../Models/ChildConfigurationType.cs | 51 + ...tion.cs => Configuration.Serialization.cs} | 188 +- .../src/Generated/Models/Configuration.cs | 89 + ...onfigurationDeviceDetails.Serialization.cs | 225 ++ .../Models/ConfigurationDeviceDetails.cs | 86 + ...s => ConfigurationFilter.Serialization.cs} | 53 +- ...ationFilters.cs => ConfigurationFilter.cs} | 18 +- ...ion.cs => Configurations.Serialization.cs} | 60 +- ...etadataListResult.cs => Configurations.cs} | 33 +- .../ConfigurationsContent.Serialization.cs | 21 +- .../Generated/Models/ConfigurationsContent.cs | 21 +- ...ion.cs => ContactDetails.Serialization.cs} | 71 +- ...essContactDetails.cs => ContactDetails.cs} | 28 +- ...on.cs => CostInformation.Serialization.cs} | 54 +- ...tCostInformation.cs => CostInformation.cs} | 16 +- ...zation.cs => Description.Serialization.cs} | 50 +- .../{ProductDescription.cs => Description.cs} | 16 +- .../src/Generated/Models/DescriptionType.cs | 48 + ...tion.cs => DeviceDetails.Serialization.cs} | 86 +- ...oductDeviceDetails.cs => DeviceDetails.cs} | 26 +- ...senceVerificationDetails.Serialization.cs} | 72 +- .../DevicePresenceVerificationDetails.cs | 69 + .../DevicePresenceVerificationStatus.cs | 51 + ...ization.cs => Dimensions.Serialization.cs} | 46 +- .../{ProductDimensions.cs => Dimensions.cs} | 14 +- ...uctDisabledReason.cs => DisabledReason.cs} | 38 +- ...zation.cs => DisplayInfo.Serialization.cs} | 38 +- .../{ProductDisplayInfo.cs => DisplayInfo.cs} | 10 +- .../Generated/Models/EdgeOrderActionStatus.cs | 51 - .../Generated/Models/EdgeOrderAddressType.cs | 54 - .../EdgeOrderAddressValidationStatus.cs | 54 - .../Models/EdgeOrderProduct.Serialization.cs | 288 -- .../src/Generated/Models/EdgeOrderProduct.cs | 96 - .../Models/EdgeOrderProductChargingType.cs | 51 - .../Models/EdgeOrderProductImageType.cs | 54 - .../Models/EdgeOrderProductMeteringType.cs | 54 - .../Generated/Models/EdgeOrderStageName.cs | 81 - .../Generated/Models/EdgeOrderStageStatus.cs | 63 - .../FilterableProperty.Serialization.cs | 2 +- .../Generated/Models/FilterableProperty.cs | 14 +- .../ForwardShippingDetails.Serialization.cs | 10 +- .../Models/ForwardShippingDetails.cs | 4 +- .../src/Generated/Models/FulfillmentType.cs | 51 + ...roupedChildConfigurations.Serialization.cs | 158 + .../Models/GroupedChildConfigurations.cs | 70 + .../HierarchyInformation.Serialization.cs | 19 +- .../Generated/Models/HierarchyInformation.cs | 6 +- .../Generated/Models/IdentificationType.cs | 51 + ...n.cs => ImageInformation.Serialization.cs} | 52 +- ...mageInformation.cs => ImageInformation.cs} | 14 +- .../src/Generated/Models/ImageType.cs | 54 + .../src/Generated/Models/LengthHeightUnit.cs | 51 + ...Serialization.cs => Link.Serialization.cs} | 52 +- .../Models/{ProductLink.cs => Link.cs} | 14 +- .../{ProductLinkType.cs => LinkType.cs} | 37 +- ...ation.cs => MeterDetails.Serialization.cs} | 36 +- ...ProductMeterDetails.cs => MeterDetails.cs} | 16 +- .../src/Generated/Models/MeteringType.cs | 54 + .../NotificationPreference.Serialization.cs | 2 +- .../Models/NotificationPreference.cs | 14 +- .../Models/OkResponse.Serialization.cs | 118 + .../src/Generated/Models/OkResponse.cs | 60 + ...Status.cs => OrderItemCancellationEnum.cs} | 28 +- ...n.cs => OrderItemDetails.Serialization.cs} | 124 +- ...rderItemDetails.cs => OrderItemDetails.cs} | 67 +- ...temDetailsUpdateParameter.Serialization.cs | 148 + .../Models/OrderItemDetailsUpdateParameter.cs | 87 + .../OrderItemResourceList.Serialization.cs | 24 +- .../Generated/Models/OrderItemResourceList.cs | 27 +- ...> OrderItemResourcePatch.Serialization.cs} | 84 +- ...ItemPatch.cs => OrderItemResourcePatch.cs} | 33 +- ...ReturnStatus.cs => OrderItemReturnEnum.cs} | 28 +- .../src/Generated/Models/OrderItemType.cs | 3 + .../src/Generated/Models/OrderMode.cs | 51 + .../Models/OrderResourceList.Serialization.cs | 24 +- .../src/Generated/Models/OrderResourceList.cs | 25 +- .../Models/Pav2MeterDetails.Serialization.cs | 14 +- .../src/Generated/Models/Pav2MeterDetails.cs | 6 +- ...zation.cs => Preferences.Serialization.cs} | 59 +- ...OrderItemPreferences.cs => Preferences.cs} | 15 +- .../Generated/Models/Product.Serialization.cs | 158 + .../{ProductConfigurations.cs => Product.cs} | 26 +- .../Models/ProductAvailabilityStage.cs | 63 - .../Generated/Models/ProductConfiguration.cs | 100 - .../Models/ProductDescriptionType.cs | 48 - .../Models/ProductDetails.Serialization.cs | 118 +- .../src/Generated/Models/ProductDetails.cs | 39 +- ...uctDetailsUpdateParameter.Serialization.cs | 133 + .../Models/ProductDetailsUpdateParameter.cs | 65 + .../Models/ProductFamilies.Serialization.cs | 18 +- .../src/Generated/Models/ProductFamilies.cs | 23 +- .../ProductFamiliesMetadata.Serialization.cs | 204 +- .../Models/ProductFamiliesMetadata.cs | 64 +- ...ctFamiliesMetadataDetails.Serialization.cs | 183 ++ .../Models/ProductFamiliesMetadataDetails.cs | 71 + .../Models/ProductFamily.Serialization.cs | 133 +- .../src/Generated/Models/ProductFamily.cs | 32 +- .../Models/ProductLengthHeightWidthUnit.cs | 51 - .../Models/ProductLine.Serialization.cs | 138 +- .../src/Generated/Models/ProductLine.cs | 36 +- .../Models/ProductWeightMeasurementUnit.cs | 51 - .../ProvisioningDetails.Serialization.cs | 263 ++ .../Generated/Models/ProvisioningDetails.cs | 102 + .../src/Generated/Models/ProvisioningState.cs | 57 + .../Generated/Models/ProvisioningSupport.cs | 51 + .../PurchaseMeterDetails.Serialization.cs | 4 +- .../Generated/Models/PurchaseMeterDetails.cs | 4 +- ...> ReturnOrderItemDetails.Serialization.cs} | 46 +- ...rnContent.cs => ReturnOrderItemDetails.cs} | 26 +- .../ReverseShippingDetails.Serialization.cs | 10 +- .../Models/ReverseShippingDetails.cs | 4 +- ...on.cs => ShippingAddress.Serialization.cs} | 49 +- ...rShippingAddress.cs => ShippingAddress.cs} | 21 +- .../Models/SiteDetails.Serialization.cs | 126 + .../src/Generated/Models/SiteDetails.cs | 75 + ...tion.cs => Specification.Serialization.cs} | 38 +- ...oductSpecification.cs => Specification.cs} | 12 +- ...ation.cs => StageDetails.Serialization.cs} | 46 +- ...geOrderStageDetails.cs => StageDetails.cs} | 14 +- .../src/Generated/Models/StageName.cs | 84 + .../src/Generated/Models/StageStatus.cs | 63 + ...ermCommitmentInformation.Serialization.cs} | 78 +- .../Models/TermCommitmentInformation.cs | 80 + ...TermCommitmentPreferences.Serialization.cs | 141 + .../Models/TermCommitmentPreferences.cs | 76 + .../Generated/Models/TermCommitmentType.cs | 54 + .../Models/TermTypeDetails.Serialization.cs | 134 + .../src/Generated/Models/TermTypeDetails.cs | 78 + .../UnknownMeterDetails.Serialization.cs | 38 +- .../Generated/Models/UnknownMeterDetails.cs | 4 +- .../Generated/Models/WeightMeasurementUnit.cs | 51 + .../OrderItemResource.Serialization.cs | 26 + ...erItemResource.cs => OrderItemResource.cs} | 302 +- ...tion.cs => OrderItemResourceCollection.cs} | 210 +- ...=> OrderItemResourceData.Serialization.cs} | 93 +- ...erItemData.cs => OrderItemResourceData.cs} | 37 +- .../Generated/OrderResource.Serialization.cs | 26 + ...{EdgeOrderResource.cs => OrderResource.cs} | 70 +- ...llection.cs => OrderResourceCollection.cs} | 122 +- ....cs => OrderResourceData.Serialization.cs} | 86 +- ...{EdgeOrderData.cs => OrderResourceData.cs} | 26 +- .../AddressResourcesRestOperations.cs | 807 +++++ .../EdgeOrderManagementRestOperations.cs | 2721 ----------------- .../OrderItemResourcesRestOperations.cs | 1029 +++++++ .../OrderResourcesRestOperations.cs | 140 + .../OrdersOperationGroupRestOperations.cs | 407 +++ ...figurationsOperationGroupRestOperations.cs | 573 ++++ .../src/autorest.md | 134 - .../tsp-location.yaml | 4 + sdk/storage/ci.yml | 2 + 205 files changed, 12981 insertions(+), 7655 deletions(-) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResourceCollection.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResourceCollection.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResourceCollection.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.Serialization.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderAddressResource.cs => AddressResource.cs} (68%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderAddressCollection.cs => AddressResourceCollection.cs} (62%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderAddressData.Serialization.cs => AddressResourceData.Serialization.cs} (61%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderAddressData.cs => AddressResourceData.cs} (62%) delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.Serialization.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.Serialization.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/AddressResourceOperationSource.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderAddressOperationSource.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderItemOperationSource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OkResponseOperationSource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OrderItemResourceOperationSource.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ActionStatusEnum.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressClassification.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemAddressDetails.Serialization.cs => AddressDetails.Serialization.cs} (61%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemAddressDetails.cs => AddressDetails.cs} (71%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.Serialization.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemAddressProperties.cs => AddressProperties.cs} (64%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderAddressPatch.Serialization.cs => AddressResourcePatch.Serialization.cs} (71%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderAddressPatch.cs => AddressResourcePatch.cs} (81%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressValidationStatus.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AutoProvisioningStatus.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductAvailabilityInformation.Serialization.cs => AvailabilityInformation.Serialization.cs} (65%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductAvailabilityInformation.cs => AvailabilityInformation.cs} (77%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityStage.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductBillingMeterDetails.Serialization.cs => BillingMeterDetails.Serialization.cs} (63%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductBillingMeterDetails.cs => BillingMeterDetails.cs} (67%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemCancellationReason.Serialization.cs => CancellationReason.Serialization.cs} (62%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemCancellationReason.cs => CancellationReason.cs} (78%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChargingType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationType.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductConfiguration.Serialization.cs => Configuration.Serialization.cs} (51%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ConfigurationFilters.Serialization.cs => ConfigurationFilter.Serialization.cs} (65%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ConfigurationFilters.cs => ConfigurationFilter.cs} (71%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductConfigurations.Serialization.cs => Configurations.Serialization.cs} (63%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductFamiliesMetadataListResult.cs => Configurations.cs} (61%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderAddressContactDetails.Serialization.cs => ContactDetails.Serialization.cs} (66%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderAddressContactDetails.cs => ContactDetails.cs} (66%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductCostInformation.Serialization.cs => CostInformation.Serialization.cs} (60%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductCostInformation.cs => CostInformation.cs} (75%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDescription.Serialization.cs => Description.Serialization.cs} (77%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDescription.cs => Description.cs} (82%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DescriptionType.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductDeviceDetails.Serialization.cs => DeviceDetails.Serialization.cs} (55%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductDeviceDetails.cs => DeviceDetails.cs} (61%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductFamiliesMetadataListResult.Serialization.cs => DevicePresenceVerificationDetails.Serialization.cs} (57%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationStatus.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDimensions.Serialization.cs => Dimensions.Serialization.cs} (77%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDimensions.cs => Dimensions.cs} (82%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDisabledReason.cs => DisabledReason.cs} (51%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDisplayInfo.Serialization.cs => DisplayInfo.Serialization.cs} (69%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductDisplayInfo.cs => DisplayInfo.cs} (84%) delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderActionStatus.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressType.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressValidationStatus.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.Serialization.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductChargingType.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageType.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeteringType.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageName.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageStatus.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FulfillmentType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/IdentificationType.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductImageInformation.Serialization.cs => ImageInformation.Serialization.cs} (60%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductImageInformation.cs => ImageInformation.cs} (78%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LengthHeightUnit.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductLink.Serialization.cs => Link.Serialization.cs} (65%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductLink.cs => Link.cs} (82%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductLinkType.cs => LinkType.cs} (50%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductMeterDetails.Serialization.cs => MeterDetails.Serialization.cs} (65%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderProductMeterDetails.cs => MeterDetails.cs} (74%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeteringType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{OrderItemCancellationStatus.cs => OrderItemCancellationEnum.cs} (56%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemDetails.Serialization.cs => OrderItemDetails.Serialization.cs} (76%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemDetails.cs => OrderItemDetails.cs} (67%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemPatch.Serialization.cs => OrderItemResourcePatch.Serialization.cs} (64%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemPatch.cs => OrderItemResourcePatch.cs} (71%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{OrderItemReturnStatus.cs => OrderItemReturnEnum.cs} (58%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderMode.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{OrderItemPreferences.Serialization.cs => Preferences.Serialization.cs} (70%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{OrderItemPreferences.cs => Preferences.cs} (84%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.Serialization.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductConfigurations.cs => Product.cs} (68%) delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityStage.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescriptionType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLengthHeightWidthUnit.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductWeightMeasurementUnit.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningSupport.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemReturnContent.Serialization.cs => ReturnOrderItemDetails.Serialization.cs} (67%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemReturnContent.cs => ReturnOrderItemDetails.cs} (71%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderShippingAddress.Serialization.cs => ShippingAddress.Serialization.cs} (77%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderShippingAddress.cs => ShippingAddress.cs} (78%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductSpecification.Serialization.cs => Specification.Serialization.cs} (67%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{ProductSpecification.cs => Specification.cs} (82%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderStageDetails.Serialization.cs => StageDetails.Serialization.cs} (70%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderStageDetails.cs => StageDetails.cs} (81%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageName.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageStatus.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/{EdgeOrderItemAddressProperties.Serialization.cs => TermCommitmentInformation.Serialization.cs} (52%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentType.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.Serialization.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/WeightMeasurementUnit.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.Serialization.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderItemResource.cs => OrderItemResource.cs} (66%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderItemCollection.cs => OrderItemResourceCollection.cs} (52%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderItemData.Serialization.cs => OrderItemResourceData.Serialization.cs} (63%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderItemData.cs => OrderItemResourceData.cs} (66%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.Serialization.cs rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderResource.cs => OrderResource.cs} (65%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderCollection.cs => OrderResourceCollection.cs} (63%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderData.Serialization.cs => OrderResourceData.Serialization.cs} (68%) rename sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/{EdgeOrderData.cs => OrderResourceData.cs} (70%) create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/AddressResourcesRestOperations.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/EdgeOrderManagementRestOperations.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderItemResourcesRestOperations.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderResourcesRestOperations.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrdersOperationGroupRestOperations.cs create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/ProductsAndConfigurationsOperationGroupRestOperations.cs delete mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/autorest.md create mode 100644 sdk/edgeorder/Azure.ResourceManager.EdgeOrder/tsp-location.yaml diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResource.cs new file mode 100644 index 000000000000..4145621e79e8 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResource.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.EdgeOrder.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_AddressResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAddressByName() + { + // Generated from example definition: 2024-02-01/GetAddressByName.json + // this example is just showing the usage of "AddressResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AddressResource created on azure + // for more information of creating AddressResource, please refer to the document of AddressResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string addressName = "TestAddressName1"; + ResourceIdentifier addressResourceId = AddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, addressName); + AddressResource addressResource = client.GetAddressResource(addressResourceId); + + // invoke the operation + AddressResource result = await addressResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteAddressByName() + { + // Generated from example definition: 2024-02-01/DeleteAddressByName.json + // this example is just showing the usage of "AddressResource_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AddressResource created on azure + // for more information of creating AddressResource, please refer to the document of AddressResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string addressName = "TestAddressName1"; + ResourceIdentifier addressResourceId = AddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, addressName); + AddressResource addressResource = client.GetAddressResource(addressResourceId); + + // invoke the operation + await addressResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateAddress() + { + // Generated from example definition: 2024-02-01/UpdateAddress.json + // this example is just showing the usage of "AddressResource_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AddressResource created on azure + // for more information of creating AddressResource, please refer to the document of AddressResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string addressName = "TestAddressName2"; + ResourceIdentifier addressResourceId = AddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, addressName); + AddressResource addressResource = client.GetAddressResource(addressResourceId); + + // invoke the operation + AddressResourcePatch patch = new AddressResourcePatch(); + ArmOperation lro = await addressResource.UpdateAsync(WaitUntil.Completed, patch); + AddressResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResourceCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResourceCollection.cs new file mode 100644 index 000000000000..b6f1d7dffa22 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_AddressResourceCollection.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_AddressResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAddress() + { + // Generated from example definition: 2024-02-01/CreateAddress.json + // this example is just showing the usage of "AddressResource_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AddressResource + AddressResourceCollection collection = resourceGroupResource.GetAddressResources(); + + // invoke the operation + string addressName = "TestAddressName2"; + AddressResourceData data = new AddressResourceData(default); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, addressName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAddressByName() + { + // Generated from example definition: 2024-02-01/GetAddressByName.json + // this example is just showing the usage of "AddressResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AddressResource + AddressResourceCollection collection = resourceGroupResource.GetAddressResources(); + + // invoke the operation + string addressName = "TestAddressName1"; + AddressResource result = await collection.GetAsync(addressName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListAddressesAtResourceGroupLevel() + { + // Generated from example definition: 2024-02-01/ListAddressesAtResourceGroupLevel.json + // this example is just showing the usage of "AddressResource_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AddressResource + AddressResourceCollection collection = resourceGroupResource.GetAddressResources(); + + // invoke the operation and iterate over the result + await foreach (AddressResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddressResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetAddressByName() + { + // Generated from example definition: 2024-02-01/GetAddressByName.json + // this example is just showing the usage of "AddressResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AddressResource + AddressResourceCollection collection = resourceGroupResource.GetAddressResources(); + + // invoke the operation + string addressName = "TestAddressName1"; + bool result = await collection.ExistsAsync(addressName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetAddressByName() + { + // Generated from example definition: 2024-02-01/GetAddressByName.json + // this example is just showing the usage of "AddressResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AddressResource + AddressResourceCollection collection = resourceGroupResource.GetAddressResources(); + + // invoke the operation + string addressName = "TestAddressName1"; + NullableResponse response = await collection.GetIfExistsAsync(addressName); + AddressResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResource.cs new file mode 100644 index 000000000000..fba8369e25a8 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResource.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.EdgeOrder.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_OrderItemResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetOrderItemByName() + { + // Generated from example definition: 2024-02-01/GetOrderItemByName.json + // this example is just showing the usage of "OrderItemResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderItemResource created on azure + // for more information of creating OrderItemResource, please refer to the document of OrderItemResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string orderItemName = "TestOrderItemName1"; + ResourceIdentifier orderItemResourceId = OrderItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, orderItemName); + OrderItemResource orderItemResource = client.GetOrderItemResource(orderItemResourceId); + + // invoke the operation + OrderItemResource result = await orderItemResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteOrderItemByName() + { + // Generated from example definition: 2024-02-01/DeleteOrderItemByName.json + // this example is just showing the usage of "OrderItemResource_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderItemResource created on azure + // for more information of creating OrderItemResource, please refer to the document of OrderItemResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string orderItemName = "TestOrderItemName3"; + ResourceIdentifier orderItemResourceId = OrderItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, orderItemName); + OrderItemResource orderItemResource = client.GetOrderItemResource(orderItemResourceId); + + // invoke the operation + await orderItemResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateOrderItem() + { + // Generated from example definition: 2024-02-01/UpdateOrderItem.json + // this example is just showing the usage of "OrderItemResource_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderItemResource created on azure + // for more information of creating OrderItemResource, please refer to the document of OrderItemResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string orderItemName = "TestOrderItemName3"; + ResourceIdentifier orderItemResourceId = OrderItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, orderItemName); + OrderItemResource orderItemResource = client.GetOrderItemResource(orderItemResourceId); + + // invoke the operation + OrderItemResourcePatch patch = new OrderItemResourcePatch(); + ArmOperation lro = await orderItemResource.UpdateAsync(WaitUntil.Completed, patch); + OrderItemResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Cancel_CancelOrderItem() + { + // Generated from example definition: 2024-02-01/CancelOrderItem.json + // this example is just showing the usage of "OrderItemResources_Cancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderItemResource created on azure + // for more information of creating OrderItemResource, please refer to the document of OrderItemResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string orderItemName = "TestOrderItemName3"; + ResourceIdentifier orderItemResourceId = OrderItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, orderItemName); + OrderItemResource orderItemResource = client.GetOrderItemResource(orderItemResourceId); + + // invoke the operation + CancellationReason cancellationReason = new CancellationReason(null); + await orderItemResource.CancelAsync(cancellationReason); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ReturnOrderItem_ReturnOrderItem() + { + // Generated from example definition: 2024-02-01/ReturnOrderItem.json + // this example is just showing the usage of "OrderItemResources_ReturnOrderItem" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderItemResource created on azure + // for more information of creating OrderItemResource, please refer to the document of OrderItemResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + string orderItemName = "TestOrderName4"; + ResourceIdentifier orderItemResourceId = OrderItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, orderItemName); + OrderItemResource orderItemResource = client.GetOrderItemResource(orderItemResourceId); + + // invoke the operation + ReturnOrderItemDetails details = new ReturnOrderItemDetails(null); + ArmOperation lro = await orderItemResource.ReturnOrderItemAsync(WaitUntil.Completed, details); + OkResponse result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResourceCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResourceCollection.cs new file mode 100644 index 000000000000..3f3f31d962ce --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderItemResourceCollection.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.EdgeOrder.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_OrderItemResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrderItem() + { + // Generated from example definition: 2024-02-01/CreateOrderItem.json + // this example is just showing the usage of "OrderItemResource_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderItemResource + OrderItemResourceCollection collection = resourceGroupResource.GetOrderItemResources(); + + // invoke the operation + string orderItemName = "TestOrderItemName2"; + OrderItemResourceData data = new OrderItemResourceData(default, null, null); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, orderItemName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetOrderItemByName() + { + // Generated from example definition: 2024-02-01/GetOrderItemByName.json + // this example is just showing the usage of "OrderItemResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderItemResource + OrderItemResourceCollection collection = resourceGroupResource.GetOrderItemResources(); + + // invoke the operation + string orderItemName = "TestOrderItemName1"; + OrderItemResource result = await collection.GetAsync(orderItemName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListOrderItemsAtResourceGroupLevel() + { + // Generated from example definition: 2024-02-01/ListOrderItemsAtResourceGroupLevel.json + // this example is just showing the usage of "OrderItemResource_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderItemResource + OrderItemResourceCollection collection = resourceGroupResource.GetOrderItemResources(); + + // invoke the operation and iterate over the result + await foreach (OrderItemResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetOrderItemByName() + { + // Generated from example definition: 2024-02-01/GetOrderItemByName.json + // this example is just showing the usage of "OrderItemResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderItemResource + OrderItemResourceCollection collection = resourceGroupResource.GetOrderItemResources(); + + // invoke the operation + string orderItemName = "TestOrderItemName1"; + bool result = await collection.ExistsAsync(orderItemName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetOrderItemByName() + { + // Generated from example definition: 2024-02-01/GetOrderItemByName.json + // this example is just showing the usage of "OrderItemResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderItemResource + OrderItemResourceCollection collection = resourceGroupResource.GetOrderItemResources(); + + // invoke the operation + string orderItemName = "TestOrderItemName1"; + NullableResponse response = await collection.GetIfExistsAsync(orderItemName); + OrderItemResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResource.cs new file mode 100644 index 000000000000..4c8bbed96312 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_OrderResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetOrderByName() + { + // Generated from example definition: 2024-02-01/GetOrderByName.json + // this example is just showing the usage of "OrderResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OrderResource created on azure + // for more information of creating OrderResource, please refer to the document of OrderResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + AzureLocation location = new AzureLocation("eastus"); + string orderName = "TestOrderName3"; + ResourceIdentifier orderResourceId = OrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, orderName); + OrderResource orderResource = client.GetOrderResource(orderResourceId); + + // invoke the operation + OrderResource result = await orderResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResourceCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResourceCollection.cs new file mode 100644 index 000000000000..d0be2d94fe2d --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_OrderResourceCollection.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.EdgeOrder.Samples +{ + public partial class Sample_OrderResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetOrderByName() + { + // Generated from example definition: 2024-02-01/GetOrderByName.json + // this example is just showing the usage of "OrderResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderResource + OrderResourceCollection collection = resourceGroupResource.GetOrderResources(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + string orderName = "TestOrderName3"; + OrderResource result = await collection.GetAsync(location, orderName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetOrderByName() + { + // Generated from example definition: 2024-02-01/GetOrderByName.json + // this example is just showing the usage of "OrderResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderResource + OrderResourceCollection collection = resourceGroupResource.GetOrderResources(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + string orderName = "TestOrderName3"; + bool result = await collection.ExistsAsync(location, orderName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetOrderByName() + { + // Generated from example definition: 2024-02-01/GetOrderByName.json + // this example is just showing the usage of "OrderResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OrderResource + OrderResourceCollection collection = resourceGroupResource.GetOrderResources(); + + // invoke the operation + AzureLocation location = new AzureLocation("eastus"); + string orderName = "TestOrderName3"; + NullableResponse response = await collection.GetIfExistsAsync(location, orderName); + OrderResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index f77c514588cb..6a42876c1ca7 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -18,10 +18,10 @@ public partial class Sample_ResourceGroupResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetEdgeOrders_ListOrderAtResourceGroupLevel() + public async Task GetOrderResources_ListOrderAtResourceGroupLevel() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtResourceGroupLevel.json - // this example is just showing the usage of "ListOrderAtResourceGroupLevel" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListOrderAtResourceGroupLevel.json + // this example is just showing the usage of "OrdersOperationGroup_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -30,17 +30,17 @@ public async Task GetEdgeOrders_ListOrderAtResourceGroupLevel() // this example assumes you already have this ResourceGroupResource created on azure // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; - string resourceGroupName = "TestRG"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; + string resourceGroupName = "YourResourceGroupName"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // invoke the operation and iterate over the result - await foreach (EdgeOrderResource item in resourceGroupResource.GetEdgeOrdersAsync()) + await foreach (OrderResource item in resourceGroupResource.GetOrderResourcesAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - EdgeOrderData resourceData = item.Data; + OrderResourceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index afe8473e72e2..b43a570b3790 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -20,10 +20,10 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetEdgeOrderAddresses_ListAddressesAtSubscriptionLevel() + public async Task GetAddressResources_ListAddressesAtSubscriptionLevel() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListAddressesAtSubscriptionLevel.json - // this example is just showing the usage of "ListAddressesAtSubscriptionLevel" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListAddressesAtSubscriptionLevel.json + // this example is just showing the usage of "AddressResource_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -32,16 +32,16 @@ public async Task GetEdgeOrderAddresses_ListAddressesAtSubscriptionLevel() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (EdgeOrderAddressResource item in subscriptionResource.GetEdgeOrderAddressesAsync()) + await foreach (AddressResource item in subscriptionResource.GetAddressResourcesAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - EdgeOrderAddressData resourceData = item.Data; + AddressResourceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -51,10 +51,10 @@ public async Task GetEdgeOrderAddresses_ListAddressesAtSubscriptionLevel() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetProductFamilies_ListProductFamilies() + public async Task GetOrderItemResources_ListOrderItemsAtSubscriptionLevel() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamilies.json - // this example is just showing the usage of "ListProductFamilies" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListOrderItemsAtSubscriptionLevel.json + // this example is just showing the usage of "OrderItemResource_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -63,21 +63,18 @@ public async Task GetProductFamilies_ListProductFamilies() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - ProductFamiliesContent content = new ProductFamiliesContent(new Dictionary> + await foreach (OrderItemResource item in subscriptionResource.GetOrderItemResourcesAsync()) { - ["azurestackedge"] = new FilterableProperty[] - { -new FilterableProperty(SupportedFilterType.ShipToCountries, new string[]{"US"}) - } - }); - await foreach (ProductFamily item in subscriptionResource.GetProductFamiliesAsync(content)) - { - Console.WriteLine($"Succeeded: {item}"); + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + OrderItemResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -85,10 +82,10 @@ public async Task GetProductFamilies_ListProductFamilies() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetConfigurations_ListConfigurations() + public async Task GetConfigurationsProductsAndConfigurationsOperationGroups_ListConfigurations() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListConfigurations.json - // this example is just showing the usage of "ListConfigurations" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListConfigurations.json + // this example is just showing the usage of "ProductsAndConfigurationsOperationGroup_ListConfigurations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -97,24 +94,13 @@ public async Task GetConfigurations_ListConfigurations() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - ConfigurationsContent content = new ConfigurationsContent(new ConfigurationFilters[] - { -new ConfigurationFilters(new HierarchyInformation -{ -ProductFamilyName = "AzureStackEdge", -ProductLineName = "AzureStackEdge", -ProductName = "AzureStackEdgeGPU", -}) -{ -FilterableProperty = {new FilterableProperty(SupportedFilterType.ShipToCountries, new string[]{"US"})}, -} - }); - await foreach (ProductConfiguration item in subscriptionResource.GetConfigurationsAsync(content)) + ConfigurationsContent content = new ConfigurationsContent(); + await foreach (Configuration item in subscriptionResource.GetConfigurationsProductsAndConfigurationsOperationGroupsAsync(content)) { Console.WriteLine($"Succeeded: {item}"); } @@ -124,10 +110,10 @@ public async Task GetConfigurations_ListConfigurations() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetProductFamiliesMetadata_ListProductFamiliesMetadata() + public async Task GetProductFamiliesProductsAndConfigurationsOperationGroups_ListProductFamilies() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamiliesMetadata.json - // this example is just showing the usage of "ListProductFamiliesMetadata" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListProductFamilies.json + // this example is just showing the usage of "ProductsAndConfigurationsOperationGroup_ListProductFamilies" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -136,12 +122,13 @@ public async Task GetProductFamiliesMetadata_ListProductFamiliesMetadata() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ProductFamiliesMetadata item in subscriptionResource.GetProductFamiliesMetadataAsync()) + ProductFamiliesContent content = new ProductFamiliesContent(null); + await foreach (ProductFamily item in subscriptionResource.GetProductFamiliesProductsAndConfigurationsOperationGroupsAsync(content)) { Console.WriteLine($"Succeeded: {item}"); } @@ -151,10 +138,10 @@ public async Task GetProductFamiliesMetadata_ListProductFamiliesMetadata() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetEdgeOrders_ListOrderAtSubscriptionLevel() + public async Task GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups_ListProductFamiliesMetadata() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtSubscriptionLevel.json - // this example is just showing the usage of "ListOrderAtSubscriptionLevel" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListProductFamiliesMetadata.json + // this example is just showing the usage of "ProductsAndConfigurationsOperationGroup_ListProductFamiliesMetadata" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -163,18 +150,14 @@ public async Task GetEdgeOrders_ListOrderAtSubscriptionLevel() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (EdgeOrderResource item in subscriptionResource.GetEdgeOrdersAsync()) + await foreach (ProductFamiliesMetadataDetails item in subscriptionResource.GetProductFamiliesMetadataProductsAndConfigurationsOperationGroupsAsync()) { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - EdgeOrderData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); @@ -182,10 +165,10 @@ public async Task GetEdgeOrders_ListOrderAtSubscriptionLevel() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetEdgeOrderItems_ListOrderItemsAtSubscriptionLevel() + public async Task GetOrderResources_ListOrderAtSubscriptionLevel() { - // Generated from example definition: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderItemsAtSubscriptionLevel.json - // this example is just showing the usage of "ListOrderItemsAtSubscriptionLevel" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-02-01/ListOrderAtSubscriptionLevel.json + // this example is just showing the usage of "OrdersOperationGroup_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -194,16 +177,16 @@ public async Task GetEdgeOrderItems_ListOrderItemsAtSubscriptionLevel() // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "fa68082f-8ff7-4a25-95c7-ce9da541242f"; + string subscriptionId = "eb5dc900-6186-49d8-b7d7-febd866fdc1d"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (EdgeOrderItemResource item in subscriptionResource.GetEdgeOrderItemsAsync()) + await foreach (OrderResource item in subscriptionResource.GetOrderResourcesAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - EdgeOrderItemData resourceData = item.Data; + OrderResourceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.Serialization.cs new file mode 100644 index 000000000000..c373ab2566e7 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.EdgeOrder +{ + public partial class AddressResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AddressResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); + + AddressResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.cs similarity index 68% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.cs index 3a9b701c4034..e05a98e6f7aa 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A Class representing an EdgeOrderAddress along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetEdgeOrderAddressResource method. - /// Otherwise you can get one from its parent resource using the GetEdgeOrderAddress method. + /// A Class representing an AddressResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAddressResource method. + /// Otherwise you can get one from its parent resource using the GetAddressResource method. /// - public partial class EdgeOrderAddressResource : ArmResource + public partial class AddressResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The addressName. @@ -35,35 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _edgeOrderAddressClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderAddressRestClient; - private readonly EdgeOrderAddressData _data; + private readonly ClientDiagnostics _addressResourceClientDiagnostics; + private readonly AddressResourcesRestOperations _addressResourceRestClient; + private readonly AddressResourceData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.EdgeOrder/addresses"; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderAddressResource() + /// Initializes a new instance of the class for mocking. + protected AddressResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal EdgeOrderAddressResource(ArmClient client, EdgeOrderAddressData data) : this(client, data.Id) + internal AddressResource(ArmClient client, AddressResourceData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal EdgeOrderAddressResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal AddressResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderAddressClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string edgeOrderAddressApiVersion); - _edgeOrderAddressRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderAddressApiVersion); + _addressResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string addressResourceApiVersion); + _addressResourceRestClient = new AddressResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, addressResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -74,7 +74,7 @@ internal EdgeOrderAddressResource(ArmClient client, ResourceIdentifier id) : bas /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual EdgeOrderAddressData Data + public virtual AddressResourceData Data { get { @@ -91,7 +91,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -99,29 +99,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Get"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Get"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -131,7 +131,7 @@ public virtual async Task> GetAsync(Cancellat } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -139,29 +139,29 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Get"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Get"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -171,7 +171,7 @@ public virtual Response Get(CancellationToken cancella } /// - /// Deletes an address. + /// Delete an address. /// /// /// Request Path @@ -179,15 +179,15 @@ public virtual Response Get(CancellationToken cancella /// /// /// Operation Id - /// DeleteAddressByName + /// AddressResource_Delete /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -195,12 +195,12 @@ public virtual Response Get(CancellationToken cancella /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Delete"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Delete"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.DeleteAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(_edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateDeleteAddressByNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _addressResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(_addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -213,7 +213,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes an address. + /// Delete an address. /// /// /// Request Path @@ -221,15 +221,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// DeleteAddressByName + /// AddressResource_Delete /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -237,12 +237,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Delete"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Delete"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.DeleteAddressByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new EdgeOrderArmOperation(_edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateDeleteAddressByNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _addressResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new EdgeOrderArmOperation(_addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -255,7 +255,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Updates the properties of an existing address. + /// Update the properties of an existing address. /// /// /// Request Path @@ -263,15 +263,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// UpdateAddress + /// AddressResource_Update /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -280,16 +280,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, EdgeOrderAddressPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AddressResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Update"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Update"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.UpdateAddressAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(new EdgeOrderAddressOperationSource(Client), _edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateUpdateAddressRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _addressResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(new AddressResourceOperationSource(Client), _addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -302,7 +302,7 @@ public virtual async Task> UpdateAsync(Wa } /// - /// Updates the properties of an existing address. + /// Update the properties of an existing address. /// /// /// Request Path @@ -310,15 +310,15 @@ public virtual async Task> UpdateAsync(Wa /// /// /// Operation Id - /// UpdateAddress + /// AddressResource_Update /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -327,16 +327,16 @@ public virtual async Task> UpdateAsync(Wa /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, EdgeOrderAddressPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, AddressResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.Update"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.Update"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.UpdateAddress(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); - var operation = new EdgeOrderArmOperation(new EdgeOrderAddressOperationSource(Client), _edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateUpdateAddressRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _addressResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new EdgeOrderArmOperation(new AddressResourceOperationSource(Client), _addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -357,15 +357,15 @@ public virtual ArmOperation Update(WaitUntil waitUntil /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -373,12 +373,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.AddTag"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.AddTag"); scope.Start(); try { @@ -387,13 +387,13 @@ public virtual async Task> AddTagAsync(string var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderAddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderAddressPatch(); + var patch = new AddressResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -419,15 +419,15 @@ public virtual async Task> AddTagAsync(string /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -435,12 +435,12 @@ public virtual async Task> AddTagAsync(string /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.AddTag"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.AddTag"); scope.Start(); try { @@ -449,13 +449,13 @@ public virtual Response AddTag(string key, string valu var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new EdgeOrderAddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new EdgeOrderAddressPatch(); + var patch = new AddressResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -481,26 +481,26 @@ public virtual Response AddTag(string key, string valu /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.SetTags"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.SetTags"); scope.Start(); try { @@ -510,13 +510,13 @@ public virtual async Task> SetTagsAsync(IDict var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderAddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderAddressPatch(); + var patch = new AddressResourcePatch(); patch.Tags.ReplaceWith(tags); var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -538,26 +538,26 @@ public virtual async Task> SetTagsAsync(IDict /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.SetTags"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.SetTags"); scope.Start(); try { @@ -567,13 +567,13 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.RemoveTag"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.RemoveTag"); scope.Start(); try { @@ -623,13 +623,13 @@ public virtual async Task> RemoveTagAsync(str var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderAddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderAddressPatch(); + var patch = new AddressResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -655,26 +655,26 @@ public virtual async Task> RemoveTagAsync(str /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressResource.RemoveTag"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResource.RemoveTag"); scope.Start(); try { @@ -683,13 +683,13 @@ public virtual Response RemoveTag(string key, Cancella var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new EdgeOrderAddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AddressResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new EdgeOrderAddressPatch(); + var patch = new AddressResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceCollection.cs similarity index 62% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceCollection.cs index ef947343dedf..dd3453951f6d 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetEdgeOrderAddresses method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAddressResources method from an instance of . /// - public partial class EdgeOrderAddressCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class AddressResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _edgeOrderAddressClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderAddressRestClient; + private readonly ClientDiagnostics _addressResourceClientDiagnostics; + private readonly AddressResourcesRestOperations _addressResourceRestClient; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderAddressCollection() + /// Initializes a new instance of the class for mocking. + protected AddressResourceCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal EdgeOrderAddressCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal AddressResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderAddressClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderAddressResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(EdgeOrderAddressResource.ResourceType, out string edgeOrderAddressApiVersion); - _edgeOrderAddressRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderAddressApiVersion); + _addressResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", AddressResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AddressResource.ResourceType, out string addressResourceApiVersion); + _addressResourceRestClient = new AddressResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, addressResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -53,7 +53,8 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Creates a new address with the specified parameters. Existing address can be updated with this API + /// Create a new address with the specified parameters. Existing address cannot be updated with this API and should + /// instead be updated with the Update address API. /// /// /// Request Path @@ -61,15 +62,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// CreateAddress + /// AddressResource_Create /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -79,19 +80,19 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string addressName, EdgeOrderAddressData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string addressName, AddressResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.CreateOrUpdate"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.CreateAddressAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, data, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(new EdgeOrderAddressOperationSource(Client), _edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateCreateAddressRequest(Id.SubscriptionId, Id.ResourceGroupName, addressName, data).Request, response, OperationFinalStateVia.Location); + var response = await _addressResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, data, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(_addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, addressName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -102,7 +103,8 @@ public virtual async Task> CreateOrUpdate } /// - /// Creates a new address with the specified parameters. Existing address can be updated with this API + /// Create a new address with the specified parameters. Existing address cannot be updated with this API and should + /// instead be updated with the Update address API. /// /// /// Request Path @@ -110,15 +112,15 @@ public virtual async Task> CreateOrUpdate /// /// /// Operation Id - /// CreateAddress + /// AddressResource_Create /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -128,19 +130,19 @@ public virtual async Task> CreateOrUpdate /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string addressName, EdgeOrderAddressData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string addressName, AddressResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.CreateOrUpdate"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.CreateAddress(Id.SubscriptionId, Id.ResourceGroupName, addressName, data, cancellationToken); - var operation = new EdgeOrderArmOperation(new EdgeOrderAddressOperationSource(Client), _edgeOrderAddressClientDiagnostics, Pipeline, _edgeOrderAddressRestClient.CreateCreateAddressRequest(Id.SubscriptionId, Id.ResourceGroupName, addressName, data).Request, response, OperationFinalStateVia.Location); + var response = _addressResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, addressName, data, cancellationToken); + var operation = new EdgeOrderArmOperation(_addressResourceClientDiagnostics, Pipeline, _addressResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, addressName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -151,7 +153,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -159,15 +161,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -175,18 +177,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string addressName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.Get"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.Get"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken).ConfigureAwait(false); + var response = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -196,7 +198,7 @@ public virtual async Task> GetAsync(string ad } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -204,15 +206,15 @@ public virtual async Task> GetAsync(string ad /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -220,18 +222,18 @@ public virtual async Task> GetAsync(string ad /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string addressName, CancellationToken cancellationToken = default) + public virtual Response Get(string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.Get"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.Get"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken); + var response = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -241,7 +243,7 @@ public virtual Response Get(string addressName, Cancel } /// - /// Lists all the addresses available under the given resource group. + /// List all the addresses available under the given resource group. /// /// /// Request Path @@ -249,31 +251,32 @@ public virtual Response Get(string addressName, Cancel /// /// /// Operation Id - /// ListAddressesAtResourceGroupLevel + /// AddressResource_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _edgeOrderAddressRestClient.CreateListAddressesAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _edgeOrderAddressRestClient.CreateListAddressesAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), _edgeOrderAddressClientDiagnostics, Pipeline, "EdgeOrderAddressCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _addressResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _addressResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AddressResource(Client, AddressResourceData.DeserializeAddressResourceData(e)), _addressResourceClientDiagnostics, Pipeline, "AddressResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// - /// Lists all the addresses available under the given resource group. + /// List all the addresses available under the given resource group. /// /// /// Request Path @@ -281,27 +284,28 @@ public virtual AsyncPageable GetAllAsync(string filter /// /// /// Operation Id - /// ListAddressesAtResourceGroupLevel + /// AddressResource_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _edgeOrderAddressRestClient.CreateListAddressesAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _edgeOrderAddressRestClient.CreateListAddressesAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), _edgeOrderAddressClientDiagnostics, Pipeline, "EdgeOrderAddressCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _addressResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _addressResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AddressResource(Client, AddressResourceData.DeserializeAddressResourceData(e)), _addressResourceClientDiagnostics, Pipeline, "AddressResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -313,15 +317,15 @@ public virtual Pageable GetAll(string filter = null, s /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -333,11 +337,11 @@ public virtual async Task> ExistsAsync(string addressName, Cancel { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.Exists"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.Exists"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -356,15 +360,15 @@ public virtual async Task> ExistsAsync(string addressName, Cancel /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -376,11 +380,11 @@ public virtual Response Exists(string addressName, CancellationToken cance { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.Exists"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.Exists"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken); + var response = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -399,15 +403,15 @@ public virtual Response Exists(string addressName, CancellationToken cance /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -415,18 +419,18 @@ public virtual Response Exists(string addressName, CancellationToken cance /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string addressName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.GetIfExists"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.GetIfExists"); scope.Start(); try { - var response = await _edgeOrderAddressRestClient.GetAddressByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addressResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -444,15 +448,15 @@ public virtual async Task> GetIfExist /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -460,18 +464,18 @@ public virtual async Task> GetIfExist /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string addressName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - using var scope = _edgeOrderAddressClientDiagnostics.CreateScope("EdgeOrderAddressCollection.GetIfExists"); + using var scope = _addressResourceClientDiagnostics.CreateScope("AddressResourceCollection.GetIfExists"); scope.Start(); try { - var response = _edgeOrderAddressRestClient.GetAddressByName(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken); + var response = _addressResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, addressName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderAddressResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AddressResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -480,7 +484,7 @@ public virtual NullableResponse GetIfExists(string add } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -490,7 +494,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.Serialization.cs similarity index 61% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.Serialization.cs index c55457db3708..e2c467b207f9 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.EdgeOrder { - public partial class EdgeOrderAddressData : IUtf8JsonSerializable, IJsonModel + public partial class AddressResourceData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,43 +30,56 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AddressResourceData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(AddressClassification)) + { + writer.WritePropertyName("addressClassification"u8); + writer.WriteStringValue(AddressClassification.Value.ToString()); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); writer.WriteObjectValue(ShippingAddress, options); } - writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails, options); + if (Optional.IsDefined(ContactDetails)) + { + writer.WritePropertyName("contactDetails"u8); + writer.WriteObjectValue(ContactDetails, options); + } if (options.Format != "W" && Optional.IsDefined(AddressValidationStatus)) { writer.WritePropertyName("addressValidationStatus"u8); writer.WriteStringValue(AddressValidationStatus.Value.ToString()); } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } writer.WriteEndObject(); } - EdgeOrderAddressData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AddressResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AddressResourceData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderAddressData(document.RootElement, options); + return DeserializeAddressResourceData(document.RootElement, options); } - internal static EdgeOrderAddressData DeserializeEdgeOrderAddressData(JsonElement element, ModelReaderWriterOptions options = null) + internal static AddressResourceData DeserializeAddressResourceData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,9 +93,11 @@ internal static EdgeOrderAddressData DeserializeEdgeOrderAddressData(JsonElement string name = default; ResourceType type = default; SystemData systemData = default; - EdgeOrderShippingAddress shippingAddress = default; - EdgeOrderAddressContactDetails contactDetails = default; - EdgeOrderAddressValidationStatus? addressValidationStatus = default; + AddressClassification? addressClassification = default; + ShippingAddress shippingAddress = default; + ContactDetails contactDetails = default; + AddressValidationStatus? addressValidationStatus = default; + ProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -139,18 +154,31 @@ internal static EdgeOrderAddressData DeserializeEdgeOrderAddressData(JsonElement } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("addressClassification"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addressClassification = new AddressClassification(property0.Value.GetString()); + continue; + } if (property0.NameEquals("shippingAddress"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - shippingAddress = EdgeOrderShippingAddress.DeserializeEdgeOrderShippingAddress(property0.Value, options); + shippingAddress = ShippingAddress.DeserializeShippingAddress(property0.Value, options); continue; } if (property0.NameEquals("contactDetails"u8)) { - contactDetails = EdgeOrderAddressContactDetails.DeserializeEdgeOrderAddressContactDetails(property0.Value, options); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contactDetails = ContactDetails.DeserializeContactDetails(property0.Value, options); continue; } if (property0.NameEquals("addressValidationStatus"u8)) @@ -159,7 +187,16 @@ internal static EdgeOrderAddressData DeserializeEdgeOrderAddressData(JsonElement { continue; } - addressValidationStatus = new EdgeOrderAddressValidationStatus(property0.Value.GetString()); + addressValidationStatus = new AddressValidationStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } @@ -171,48 +208,50 @@ internal static EdgeOrderAddressData DeserializeEdgeOrderAddressData(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderAddressData( + return new AddressResourceData( id, name, type, systemData, tags ?? new ChangeTrackingDictionary(), location, + addressClassification, shippingAddress, contactDetails, addressValidationStatus, + provisioningState, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderAddressData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressResourceData)} does not support writing '{options.Format}' format."); } } - EdgeOrderAddressData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AddressResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderAddressData(document.RootElement, options); + return DeserializeAddressResourceData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderAddressData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressResourceData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.cs similarity index 62% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.cs index 0545e5092d24..ae1ad64d58d3 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressData.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/AddressResourceData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing the EdgeOrderAddress data model. + /// A class representing the AddressResource data model. /// Address Resource. /// - public partial class EdgeOrderAddressData : TrackedResourceData + public partial class AddressResourceData : TrackedResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,46 +51,49 @@ public partial class EdgeOrderAddressData : TrackedResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The location. - /// Contact details for the address. - /// is null. - public EdgeOrderAddressData(AzureLocation location, EdgeOrderAddressContactDetails contactDetails) : base(location) + public AddressResourceData(AzureLocation location) : base(location) { - Argument.AssertNotNull(contactDetails, nameof(contactDetails)); - - ContactDetails = contactDetails; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. + /// Type of address based on its usage context. /// Shipping details for the address. /// Contact details for the address. /// Status of address validation. + /// Provisioning state. /// Keeps track of any properties unknown to the library. - internal EdgeOrderAddressData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, EdgeOrderShippingAddress shippingAddress, EdgeOrderAddressContactDetails contactDetails, EdgeOrderAddressValidationStatus? addressValidationStatus, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal AddressResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AddressClassification? addressClassification, ShippingAddress shippingAddress, ContactDetails contactDetails, AddressValidationStatus? addressValidationStatus, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + AddressClassification = addressClassification; ShippingAddress = shippingAddress; ContactDetails = contactDetails; AddressValidationStatus = addressValidationStatus; + ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderAddressData() + /// Initializes a new instance of for deserialization. + internal AddressResourceData() { } + /// Type of address based on its usage context. + public AddressClassification? AddressClassification { get; set; } /// Shipping details for the address. - public EdgeOrderShippingAddress ShippingAddress { get; set; } + public ShippingAddress ShippingAddress { get; set; } /// Contact details for the address. - public EdgeOrderAddressContactDetails ContactDetails { get; set; } + public ContactDetails ContactDetails { get; set; } /// Status of address validation. - public EdgeOrderAddressValidationStatus? AddressValidationStatus { get; } + public AddressValidationStatus? AddressValidationStatus { get; } + /// Provisioning state. + public ProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/ArmEdgeOrderModelFactory.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/ArmEdgeOrderModelFactory.cs index d69edcc2229e..0e93c842e109 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/ArmEdgeOrderModelFactory.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/ArmEdgeOrderModelFactory.cs @@ -16,379 +16,57 @@ namespace Azure.ResourceManager.EdgeOrder.Models /// Model factory for models. public static partial class ArmEdgeOrderModelFactory { - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. + /// Type of address based on its usage context. /// Shipping details for the address. /// Contact details for the address. /// Status of address validation. - /// A new instance for mocking. - public static EdgeOrderAddressData EdgeOrderAddressData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, EdgeOrderShippingAddress shippingAddress = null, EdgeOrderAddressContactDetails contactDetails = null, EdgeOrderAddressValidationStatus? addressValidationStatus = null) + /// Provisioning state. + /// A new instance for mocking. + public static AddressResourceData AddressResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AddressClassification? addressClassification = null, ShippingAddress shippingAddress = null, ContactDetails contactDetails = null, AddressValidationStatus? addressValidationStatus = null, ProvisioningState? provisioningState = null) { tags ??= new Dictionary(); - return new EdgeOrderAddressData( + return new AddressResourceData( id, name, resourceType, systemData, tags, location, + addressClassification, shippingAddress, contactDetails, addressValidationStatus, + provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Type of address based on its usage context. /// Shipping details for the address. /// Contact details for the address. /// Status of address validation. - /// A new instance for mocking. - public static EdgeOrderItemAddressProperties EdgeOrderItemAddressProperties(EdgeOrderShippingAddress shippingAddress = null, EdgeOrderAddressContactDetails contactDetails = null, EdgeOrderAddressValidationStatus? addressValidationStatus = null) + /// Provisioning state. + /// A new instance for mocking. + public static AddressProperties AddressProperties(AddressClassification? addressClassification = null, ShippingAddress shippingAddress = null, ContactDetails contactDetails = null, AddressValidationStatus? addressValidationStatus = null, ProvisioningState? provisioningState = null) { - return new EdgeOrderItemAddressProperties(shippingAddress, contactDetails, addressValidationStatus, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// List of registered feature flags for subscription. - /// Location placement Id of a subscription. - /// Quota ID of a subscription. - /// A new instance for mocking. - public static CustomerSubscriptionDetails CustomerSubscriptionDetails(IEnumerable registeredFeatures = null, string locationPlacementId = null, string quotaId = null) - { - registeredFeatures ??= new List(); - - return new CustomerSubscriptionDetails(registeredFeatures?.ToList(), locationPlacementId, quotaId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of product lines supported in the product family. - /// Contains details related to resource provider. - /// A new instance for mocking. - public static ProductFamily ProductFamily(string displayName = null, ProductDescription description = null, IEnumerable imageInformation = null, EdgeOrderProductCostInformation costInformation = null, ProductAvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperties = null, IEnumerable productLines = null, IEnumerable resourceProviderDetails = null) - { - imageInformation ??= new List(); - filterableProperties ??= new List(); - productLines ??= new List(); - resourceProviderDetails ??= new List(); - - return new ProductFamily( - displayName, - description, - imageInformation?.ToList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties?.ToList(), - productLines?.ToList(), - resourceProviderDetails?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of products in the product line. - /// A new instance for mocking. - public static ProductLine ProductLine(string displayName = null, ProductDescription description = null, IEnumerable imageInformation = null, EdgeOrderProductCostInformation costInformation = null, ProductAvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperties = null, IEnumerable products = null) - { - imageInformation ??= new List(); - filterableProperties ??= new List(); - products ??= new List(); - - return new ProductLine( - displayName, - description, - imageInformation?.ToList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties?.ToList(), - products?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of configurations for the product. - /// A new instance for mocking. - public static EdgeOrderProduct EdgeOrderProduct(string displayName = null, ProductDescription description = null, IEnumerable imageInformation = null, EdgeOrderProductCostInformation costInformation = null, ProductAvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperties = null, IEnumerable configurations = null) - { - imageInformation ??= new List(); - filterableProperties ??= new List(); - configurations ??= new List(); - - return new EdgeOrderProduct( - displayName, - description, - imageInformation?.ToList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties?.ToList(), - configurations?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// Specifications of the configuration. - /// Dimensions of the configuration. - /// A new instance for mocking. - public static ProductConfiguration ProductConfiguration(string displayName = null, ProductDescription description = null, IEnumerable imageInformation = null, EdgeOrderProductCostInformation costInformation = null, ProductAvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperties = null, IEnumerable specifications = null, ProductDimensions dimensions = null) - { - imageInformation ??= new List(); - filterableProperties ??= new List(); - specifications ??= new List(); - - return new ProductConfiguration( - displayName, - description, - imageInformation?.ToList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties?.ToList(), - specifications?.ToList(), - dimensions, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Name of the specification. - /// Value of the specification. - /// A new instance for mocking. - public static ProductSpecification ProductSpecification(string name = null, string value = null) - { - return new ProductSpecification(name, value, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Length of the device. - /// Height of the device. - /// Width of the device. - /// Unit for the dimensions of length, height and width. - /// Weight of the device. - /// Depth of the device. - /// Unit for the dimensions of weight. - /// A new instance for mocking. - public static ProductDimensions ProductDimensions(double? length = null, double? height = null, double? width = null, ProductLengthHeightWidthUnit? lengthHeightUnit = null, double? weight = null, double? depth = null, ProductWeightMeasurementUnit? weightUnit = null) - { - return new ProductDimensions( - length, - height, - width, - lengthHeightUnit, - weight, - depth, - weightUnit, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of description. - /// Short description of the product system. - /// Long description of the product system. - /// Keywords for the product system. - /// Attributes for the product system. - /// Links for the product system. - /// A new instance for mocking. - public static ProductDescription ProductDescription(ProductDescriptionType? descriptionType = null, string shortDescription = null, string longDescription = null, IEnumerable keywords = null, IEnumerable attributes = null, IEnumerable links = null) - { - keywords ??= new List(); - attributes ??= new List(); - links ??= new List(); - - return new ProductDescription( - descriptionType, - shortDescription, - longDescription, - keywords?.ToList(), - attributes?.ToList(), - links?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of link. - /// Url of the link. - /// A new instance for mocking. - public static ProductLink ProductLink(ProductLinkType? linkType = null, Uri linkUri = null) - { - return new ProductLink(linkType, linkUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of the image. - /// Url of the image. - /// A new instance for mocking. - public static EdgeOrderProductImageInformation EdgeOrderProductImageInformation(EdgeOrderProductImageType? imageType = null, Uri imageUri = null) - { - return new EdgeOrderProductImageInformation(imageType, imageUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Details on the various billing aspects for the product system. - /// Default url to display billing information. - /// A new instance for mocking. - public static EdgeOrderProductCostInformation EdgeOrderProductCostInformation(IEnumerable billingMeterDetails = null, Uri billingInfoUri = null) - { - billingMeterDetails ??= new List(); - - return new EdgeOrderProductCostInformation(billingMeterDetails?.ToList(), billingInfoUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Represents Billing type name. - /// - /// Represents MeterDetails - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Represents Metering type (eg one-time or recurrent). - /// Frequency of recurrence. - /// A new instance for mocking. - public static EdgeOrderProductBillingMeterDetails EdgeOrderProductBillingMeterDetails(string name = null, EdgeOrderProductMeterDetails meterDetails = null, EdgeOrderProductMeteringType? meteringType = null, string frequency = null) - { - return new EdgeOrderProductBillingMeterDetails(name, meterDetails, meteringType, frequency, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Represents billing type. - /// Billing unit applicable for Pav2 billing. - /// Charging type. - /// A new instance for mocking. - public static EdgeOrderProductMeterDetails EdgeOrderProductMeterDetails(string billingType = null, double? multiplier = null, EdgeOrderProductChargingType? chargingType = null) - { - return new UnknownMeterDetails(billingType == null ? default : new BillingType(billingType), multiplier, chargingType, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Current availability stage of the product. Availability stage. - /// Reason why the product is disabled. - /// Message for why the product is disabled. - /// A new instance for mocking. - public static ProductAvailabilityInformation ProductAvailabilityInformation(ProductAvailabilityStage? availabilityStage = null, ProductDisabledReason? disabledReason = null, string disabledReasonMessage = null) - { - return new ProductAvailabilityInformation(availabilityStage, disabledReason, disabledReasonMessage, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Resource provider namespace. - /// A new instance for mocking. - public static ResourceProviderDetails ResourceProviderDetails(string resourceProviderNamespace = null) - { - return new ResourceProviderDetails(resourceProviderNamespace, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Product hierarchy information. - /// Filters specific to product. - /// A new instance for mocking. - public static ConfigurationFilters ConfigurationFilters(HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperty = null) - { - filterableProperty ??= new List(); - - return new ConfigurationFilters(hierarchyInformation, filterableProperty?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of product lines supported in the product family. - /// Contains details related to resource provider. - /// A new instance for mocking. - public static ProductFamiliesMetadata ProductFamiliesMetadata(string displayName = null, ProductDescription description = null, IEnumerable imageInformation = null, EdgeOrderProductCostInformation costInformation = null, ProductAvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperties = null, IEnumerable productLines = null, IEnumerable resourceProviderDetails = null) - { - imageInformation ??= new List(); - filterableProperties ??= new List(); - productLines ??= new List(); - resourceProviderDetails ??= new List(); - - return new ProductFamiliesMetadata( - displayName, - description, - imageInformation?.ToList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties?.ToList(), - productLines?.ToList(), - resourceProviderDetails?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// List of order item ARM Ids which are part of an order. - /// Order current status. - /// Order status history. - /// A new instance for mocking. - public static EdgeOrderData EdgeOrderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable orderItemIds = null, EdgeOrderStageDetails currentStage = null, IEnumerable orderStageHistory = null) - { - orderItemIds ??= new List(); - orderStageHistory ??= new List(); - - return new EdgeOrderData( - id, - name, - resourceType, - systemData, - orderItemIds?.ToList(), - currentStage, - orderStageHistory?.ToList(), + return new AddressProperties( + addressClassification, + shippingAddress, + contactDetails, + addressValidationStatus, + provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Stage status. - /// Stage name. - /// Display name of the resource stage. - /// Stage start time. - /// A new instance for mocking. - public static EdgeOrderStageDetails EdgeOrderStageDetails(EdgeOrderStageStatus? stageStatus = null, EdgeOrderStageName? stageName = null, string displayName = null, DateTimeOffset? startOn = null) - { - return new EdgeOrderStageDetails(stageStatus, stageName, displayName, startOn, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -399,12 +77,14 @@ public static EdgeOrderStageDetails EdgeOrderStageDetails(EdgeOrderStageStatus? /// Represents shipping and return address for order item. /// Start time of order item. /// Id of the order to which order item belongs to. - /// A new instance for mocking. - public static EdgeOrderItemData EdgeOrderItemData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, EdgeOrderItemDetails orderItemDetails = null, EdgeOrderItemAddressDetails addressDetails = null, DateTimeOffset? startOn = null, ResourceIdentifier orderId = null) + /// Provisioning state. + /// Msi identity of the resource. + /// A new instance for mocking. + public static OrderItemResourceData OrderItemResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, OrderItemDetails orderItemDetails = null, AddressDetails addressDetails = null, DateTimeOffset? startOn = null, string orderId = null, ProvisioningState? provisioningState = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); - return new EdgeOrderItemData( + return new OrderItemResourceData( id, name, resourceType, @@ -415,12 +95,16 @@ public static EdgeOrderItemData EdgeOrderItemData(ResourceIdentifier id = null, addressDetails, startOn, orderId, + provisioningState, + identity, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Unique identifier for configuration. + /// Initializes a new instance of . + /// Represents product details. /// Order item type. + /// Defines the mode of the Order item. + /// Site Related Details. /// Current Order item Status. /// Order item status history. /// Customer notification Preferences. @@ -432,19 +116,20 @@ public static EdgeOrderItemData EdgeOrderItemData(ResourceIdentifier id = null, /// Describes whether the order item is deletable or not. /// Return reason. /// Describes whether the order item is returnable or not. - /// Parent RP details - this returns only the first or default parent RP from the entire list. - /// List of parent RP details supported for configuration. + /// List of parent RP details supported for configuration. /// Top level error for the job. - /// A new instance for mocking. - public static EdgeOrderItemDetails EdgeOrderItemDetails(ProductDetails productDetails = null, OrderItemType orderItemType = default, EdgeOrderStageDetails currentStage = null, IEnumerable orderItemStageHistory = null, OrderItemPreferences preferences = null, ForwardShippingDetails forwardShippingDetails = null, ReverseShippingDetails reverseShippingDetails = null, IEnumerable notificationEmailList = null, string cancellationReason = null, OrderItemCancellationStatus? cancellationStatus = null, EdgeOrderActionStatus? deletionStatus = null, string returnReason = null, OrderItemReturnStatus? returnStatus = null, string firstOrDefaultManagementResourceProviderNamespace = null, IEnumerable managementRPDetailsList = null, ResponseError error = null) + /// A new instance for mocking. + public static OrderItemDetails OrderItemDetails(ProductDetails productDetails = null, OrderItemType orderItemType = default, OrderMode? orderItemMode = null, string siteId = null, StageDetails currentStage = null, IEnumerable orderItemStageHistory = null, Preferences preferences = null, ForwardShippingDetails forwardShippingDetails = null, ReverseShippingDetails reverseShippingDetails = null, IEnumerable notificationEmailList = null, string cancellationReason = null, OrderItemCancellationEnum? cancellationStatus = null, ActionStatusEnum? deletionStatus = null, string returnReason = null, OrderItemReturnEnum? returnStatus = null, IEnumerable managementRpDetailsList = null, ResponseError error = null) { - orderItemStageHistory ??= new List(); + orderItemStageHistory ??= new List(); notificationEmailList ??= new List(); - managementRPDetailsList ??= new List(); + managementRpDetailsList ??= new List(); - return new EdgeOrderItemDetails( + return new OrderItemDetails( productDetails, orderItemType, + orderItemMode, + siteId != null ? new SiteDetails(siteId, serializedAdditionalRawData: null) : null, currentStage, orderItemStageHistory?.ToList(), preferences, @@ -456,8 +141,7 @@ public static EdgeOrderItemDetails EdgeOrderItemDetails(ProductDetails productDe deletionStatus, returnReason, returnStatus, - firstOrDefaultManagementResourceProviderNamespace != null ? new ResourceProviderDetails(firstOrDefaultManagementResourceProviderNamespace, serializedAdditionalRawData: null) : null, - managementRPDetailsList?.ToList(), + managementRpDetailsList?.ToList(), error, serializedAdditionalRawData: null); } @@ -465,40 +149,139 @@ public static EdgeOrderItemDetails EdgeOrderItemDetails(ProductDetails productDe /// Initializes a new instance of . /// Display details of the product. /// Hierarchy of the product which uniquely identifies the product. - /// Quantity of the product. /// Double encryption status of the configuration. Read-only field. - /// list of device details. + /// Identification type of the configuration. + /// Device details of the parent configuration. + /// Device Provisioning Details for Parent. + /// List of additional configurations customer wants in the order item apart from the ones included in the base configuration. + /// Details of all child configurations that are part of the order item. + /// Term Commitment Information of the Device. /// A new instance for mocking. - public static ProductDetails ProductDetails(ProductDisplayInfo displayInfo = null, HierarchyInformation hierarchyInformation = null, int? count = null, DoubleEncryptionStatus? productDoubleEncryptionStatus = null, IEnumerable deviceDetails = null) + public static ProductDetails ProductDetails(DisplayInfo displayInfo = null, HierarchyInformation hierarchyInformation = null, DoubleEncryptionStatus? productDoubleEncryptionStatus = null, IdentificationType? identificationType = null, DeviceDetails parentDeviceDetails = null, ProvisioningDetails parentProvisioningDetails = null, IEnumerable optInAdditionalConfigurations = null, IEnumerable childConfigurationDeviceDetails = null, TermCommitmentInformation termCommitmentInformation = null) { - deviceDetails ??= new List(); + optInAdditionalConfigurations ??= new List(); + childConfigurationDeviceDetails ??= new List(); return new ProductDetails( displayInfo, hierarchyInformation, - count, productDoubleEncryptionStatus, - deviceDetails?.ToList(), + identificationType, + parentDeviceDetails, + parentProvisioningDetails, + optInAdditionalConfigurations?.ToList(), + childConfigurationDeviceDetails?.ToList(), + termCommitmentInformation, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Product family display name. /// Configuration display name. - /// A new instance for mocking. - public static ProductDisplayInfo ProductDisplayInfo(string productFamilyDisplayName = null, string configurationDisplayName = null) + /// A new instance for mocking. + public static DisplayInfo DisplayInfo(string productFamilyDisplayName = null, string configurationDisplayName = null) { - return new ProductDisplayInfo(productFamilyDisplayName, configurationDisplayName, serializedAdditionalRawData: null); + return new DisplayInfo(productFamilyDisplayName, configurationDisplayName, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// device serial number. + /// Initializes a new instance of . + /// Device serial number. + /// Device serial number to be displayed. /// Management Resource Id. /// Management Resource Tenant ID. - /// A new instance for mocking. - public static EdgeOrderProductDeviceDetails EdgeOrderProductDeviceDetails(string serialNumber = null, string managementResourceId = null, string managementResourceTenantId = null) + /// Determining nature of provisioning that the configuration supports. + /// Provisioning Details for the device. + /// A new instance for mocking. + public static DeviceDetails DeviceDetails(string serialNumber = null, string displaySerialNumber = null, string managementResourceId = null, string managementResourceTenantId = null, ProvisioningSupport? provisioningSupport = null, ProvisioningDetails provisioningDetails = null) + { + return new DeviceDetails( + serialNumber, + displaySerialNumber, + managementResourceId, + managementResourceTenantId, + provisioningSupport, + provisioningDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Quantity of the devices. + /// Provisioning Resource Arm ID. + /// Provisioning End Point. + /// Serial Number for the Device. + /// Vendor Name for the Device , (for 1P devices - Microsoft). + /// Arc Enabled Resource Arm id. + /// Management Resource ArmId. + /// Unique Identity for a Device. + /// Auto Provisioning Details. + /// Proof of possession details. + /// A new instance for mocking. + public static ProvisioningDetails ProvisioningDetails(int? quantity = null, ResourceIdentifier provisioningArmId = null, string provisioningEndPoint = null, string serialNumber = null, string vendorName = null, ResourceIdentifier readyToConnectArmId = null, ResourceIdentifier managementResourceArmId = null, string uniqueDeviceIdentifier = null, AutoProvisioningStatus? autoProvisioningStatus = null, DevicePresenceVerificationDetails devicePresenceVerification = null) + { + return new ProvisioningDetails( + quantity, + provisioningArmId, + provisioningEndPoint, + serialNumber, + vendorName, + readyToConnectArmId, + managementResourceArmId, + uniqueDeviceIdentifier, + autoProvisioningStatus, + devicePresenceVerification, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Proof of possession status. + /// Insights on current status. + /// A new instance for mocking. + public static DevicePresenceVerificationDetails DevicePresenceVerificationDetails(DevicePresenceVerificationStatus? status = null, string message = null) { - return new EdgeOrderProductDeviceDetails(serialNumber, managementResourceId, managementResourceTenantId, serializedAdditionalRawData: null); + return new DevicePresenceVerificationDetails(status, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display details of the product. + /// Hierarchy of the product which uniquely identifies the configuration. + /// Quantity of the product. + /// Identification type of the configuration. + /// List of device details. + /// Term Commitment Information of the Device. + /// A new instance for mocking. + public static ConfigurationDeviceDetails ConfigurationDeviceDetails(DisplayInfo displayInfo = null, HierarchyInformation hierarchyInformation = null, int? quantity = null, IdentificationType? identificationType = null, IEnumerable deviceDetails = null, TermCommitmentInformation termCommitmentInformation = null) + { + deviceDetails ??= new List(); + + return new ConfigurationDeviceDetails( + displayInfo, + hierarchyInformation, + quantity, + identificationType, + deviceDetails?.ToList(), + termCommitmentInformation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Term Commitment Duration. Currently Supporting P365D, P1095D. + /// Number of Days Pending for Term Commitment. + /// A new instance for mocking. + public static TermCommitmentInformation TermCommitmentInformation(TermCommitmentType termCommitmentType = default, TimeSpan? termCommitmentTypeDuration = null, int? pendingDaysForTerm = null) + { + return new TermCommitmentInformation(termCommitmentType, termCommitmentTypeDuration, pendingDaysForTerm, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Stage status. + /// Stage name. + /// Display name of the resource stage. + /// Stage start time. + /// A new instance for mocking. + public static StageDetails StageDetails(StageStatus? stageStatus = null, StageName? stageName = null, string displayName = null, DateTimeOffset? startOn = null) + { + return new StageDetails(stageStatus, stageName, displayName, startOn, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -507,7 +290,7 @@ public static EdgeOrderProductDeviceDetails EdgeOrderProductDeviceDetails(string /// TrackingId of the package. /// TrackingUrl of the package. /// A new instance for mocking. - public static ForwardShippingDetails ForwardShippingDetails(string carrierName = null, string carrierDisplayName = null, string trackingId = null, Uri trackingUri = null) + public static ForwardShippingDetails ForwardShippingDetails(string carrierName = null, string carrierDisplayName = null, string trackingId = null, string trackingUri = null) { return new ForwardShippingDetails(carrierName, carrierDisplayName, trackingId, trackingUri, serializedAdditionalRawData: null); } @@ -519,7 +302,7 @@ public static ForwardShippingDetails ForwardShippingDetails(string carrierName = /// TrackingId of the package. /// TrackingUrl of the package. /// A new instance for mocking. - public static ReverseShippingDetails ReverseShippingDetails(string sasKeyForLabel = null, string carrierName = null, string carrierDisplayName = null, string trackingId = null, Uri trackingUri = null) + public static ReverseShippingDetails ReverseShippingDetails(string sasKeyForLabel = null, string carrierName = null, string carrierDisplayName = null, string trackingId = null, string trackingUri = null) { return new ReverseShippingDetails( sasKeyForLabel, @@ -530,24 +313,299 @@ public static ReverseShippingDetails ReverseShippingDetails(string sasKeyForLabe serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Customer address and contact details. It should be address resource. + /// Initializes a new instance of . + /// Resource provider namespace. + /// A new instance for mocking. + public static ResourceProviderDetails ResourceProviderDetails(string resourceProviderNamespace = null) + { + return new ResourceProviderDetails(resourceProviderNamespace, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Customer address and contact details. /// Return shipping address. - /// A new instance for mocking. - public static EdgeOrderItemAddressDetails EdgeOrderItemAddressDetails(EdgeOrderItemAddressProperties forwardAddress = null, EdgeOrderItemAddressProperties returnAddress = null) + /// A new instance for mocking. + public static AddressDetails AddressDetails(AddressProperties forwardAddress = null, AddressProperties returnAddress = null) { - return new EdgeOrderItemAddressDetails(forwardAddress, returnAddress, serializedAdditionalRawData: null); + return new AddressDetails(forwardAddress, returnAddress, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// customer return address. + /// Initializes a new instance of . + /// Customer return address. /// Return Reason. /// Service tag (located on the bottom-right corner of the device). - /// Shipping Box required. - /// A new instance for mocking. - public static EdgeOrderItemReturnContent EdgeOrderItemReturnContent(EdgeOrderItemAddressProperties returnAddress = null, string returnReason = null, string serviceTag = null, bool? isShippingBoxRequired = null) + /// Shipping Box required. + /// A new instance for mocking. + public static ReturnOrderItemDetails ReturnOrderItemDetails(AddressProperties returnAddress = null, string returnReason = null, string serviceTag = null, bool? shippingBoxRequired = null) + { + return new ReturnOrderItemDetails(returnAddress, returnReason, serviceTag, shippingBoxRequired, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// List of order item ARM Ids which are part of an order. + /// Order current status. + /// Order status history. + /// Order mode. + /// A new instance for mocking. + public static OrderResourceData OrderResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable orderItemIds = null, StageDetails currentStage = null, IEnumerable orderStageHistory = null, OrderMode? orderMode = null) + { + orderItemIds ??= new List(); + orderStageHistory ??= new List(); + + return new OrderResourceData( + id, + name, + resourceType, + systemData, + orderItemIds?.ToList(), + currentStage, + orderStageHistory?.ToList(), + orderMode, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Product hierarchy information. + /// Filters specific to product. + /// Filter to fetch specific child configurations that exist in the configuration. This must be passed to either fetch a list of specific child configurations, or all child configurations of specific types of child configurations. + /// A new instance for mocking. + public static ConfigurationFilter ConfigurationFilter(HierarchyInformation hierarchyInformation = null, IEnumerable filterableProperty = null, ChildConfigurationFilter childConfigurationFilter = null) + { + filterableProperty ??= new List(); + + return new ConfigurationFilter(hierarchyInformation, filterableProperty?.ToList(), childConfigurationFilter, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of registered feature flags for subscription. + /// Location placement Id of a subscription. + /// Quota ID of a subscription. + /// A new instance for mocking. + public static CustomerSubscriptionDetails CustomerSubscriptionDetails(IEnumerable registeredFeatures = null, string locationPlacementId = null, string quotaId = null) { - return new EdgeOrderItemReturnContent(returnAddress, returnReason, serviceTag, isShippingBoxRequired, serializedAdditionalRawData: null); + registeredFeatures ??= new List(); + + return new CustomerSubscriptionDetails(registeredFeatures?.ToList(), locationPlacementId, quotaId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Specifications of the configuration. + /// Dimensions of the configuration. + /// Determining nature of provisioning that the configuration supports. + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + /// The Term Commitment Durations that are supported for a configuration. + /// A new instance for mocking. + public static Configuration Configuration(IEnumerable specifications = null, Dimensions dimensions = null, ProvisioningSupport? provisioningSupport = null, IEnumerable childConfigurationTypes = null, IEnumerable groupedChildConfigurations = null, IEnumerable supportedTermCommitmentDurations = null) + { + specifications ??= new List(); + childConfigurationTypes ??= new List(); + groupedChildConfigurations ??= new List(); + supportedTermCommitmentDurations ??= new List(); + + return new Configuration( + specifications?.ToList(), + dimensions, + provisioningSupport, + childConfigurationTypes?.ToList(), + groupedChildConfigurations?.ToList(), + supportedTermCommitmentDurations?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the specification. + /// Value of the specification. + /// A new instance for mocking. + public static Specification Specification(string name = null, string value = null) + { + return new Specification(name, value, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Length of the device. + /// Height of the device. + /// Width of the device. + /// Unit for the dimensions of length, height and width. + /// Weight of the device. + /// Depth of the device. + /// Unit for the dimensions of weight. + /// A new instance for mocking. + public static Dimensions Dimensions(double? length = null, double? height = null, double? width = null, LengthHeightUnit? lengthHeightUnit = null, double? weight = null, double? depth = null, WeightMeasurementUnit? weightUnit = null) + { + return new Dimensions( + length, + height, + width, + lengthHeightUnit, + weight, + depth, + weightUnit, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Category information. + /// List of child configurations. + /// A new instance for mocking. + public static GroupedChildConfigurations GroupedChildConfigurations(CategoryInformation categoryInformation = null, IEnumerable childConfigurations = null) + { + childConfigurations ??= new List(); + + return new GroupedChildConfigurations(categoryInformation, childConfigurations?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Category name of the child configuration. + /// Category display name of the child configuration. + /// Description text for the category. + /// Links for the category. + /// A new instance for mocking. + public static CategoryInformation CategoryInformation(string categoryName = null, string categoryDisplayName = null, string description = null, IEnumerable links = null) + { + links ??= new List(); + + return new CategoryInformation(categoryName, categoryDisplayName, description, links?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type of link. + /// Url of the link. + /// A new instance for mocking. + public static Link Link(LinkType? linkType = null, string linkUri = null) + { + return new Link(linkType, linkUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Child configuration type. + /// Flag to indicate if the child configuration is part of the base configuration, which means the customer need not pass this configuration in OptInAdditionalConfigurations while placing an order, it will be shipped by default. + /// Minimum quantity a customer can order while choosing this configuration. + /// Maximum quantity a customer can order while choosing this configuration. + /// Specifications of the configuration. + /// Dimensions of the configuration. + /// Determining nature of provisioning that the configuration supports. + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + /// The Term Commitment Durations that are supported for a configuration. + /// List of filters supported for a product. + /// Display Name for the product system. + /// Description related to the product system. + /// Image information for the product system. + /// Cost information for the product system. + /// Availability information of the product system. + /// Hierarchy information of a product. + /// The entity responsible for fulfillment of the item at the given hierarchy level. + /// A new instance for mocking. + public static ChildConfiguration ChildConfiguration(ChildConfigurationType? childConfigurationType = null, bool? isPartOfBaseConfiguration = null, int? minimumQuantity = null, int? maximumQuantity = null, IEnumerable specifications = null, Dimensions dimensions = null, ProvisioningSupport? provisioningSupport = null, IEnumerable childConfigurationTypes = null, IEnumerable groupedChildConfigurations = null, IEnumerable supportedTermCommitmentDurations = null, IEnumerable filterableProperties = null, string displayName = null, Description description = null, IEnumerable imageInformation = null, CostInformation costInformation = null, AvailabilityInformation availabilityInformation = null, HierarchyInformation hierarchyInformation = null, FulfillmentType? fulfilledBy = null) + { + specifications ??= new List(); + childConfigurationTypes ??= new List(); + groupedChildConfigurations ??= new List(); + supportedTermCommitmentDurations ??= new List(); + filterableProperties ??= new List(); + imageInformation ??= new List(); + + return new ChildConfiguration( + childConfigurationType, + isPartOfBaseConfiguration, + minimumQuantity, + maximumQuantity, + specifications?.ToList(), + dimensions, + provisioningSupport, + childConfigurationTypes?.ToList(), + groupedChildConfigurations?.ToList(), + supportedTermCommitmentDurations?.ToList(), + filterableProperties?.ToList(), + displayName, + description, + imageInformation?.ToList(), + costInformation, + availabilityInformation, + hierarchyInformation, + fulfilledBy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type of description. + /// Short description of the product system. + /// Long description of the product system. + /// Keywords for the product system. + /// Attributes for the product system. + /// Links for the product system. + /// A new instance for mocking. + public static Description Description(DescriptionType? descriptionType = null, string shortDescription = null, string longDescription = null, IEnumerable keywords = null, IEnumerable attributes = null, IEnumerable links = null) + { + keywords ??= new List(); + attributes ??= new List(); + links ??= new List(); + + return new Description( + descriptionType, + shortDescription, + longDescription, + keywords?.ToList(), + attributes?.ToList(), + links?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type of the image. + /// Url of the image. + /// A new instance for mocking. + public static ImageInformation ImageInformation(ImageType? imageType = null, string imageUri = null) + { + return new ImageInformation(imageType, imageUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Details on the various billing aspects for the product system. + /// Default url to display billing information. + /// A new instance for mocking. + public static CostInformation CostInformation(IEnumerable billingMeterDetails = null, string billingInfoUri = null) + { + billingMeterDetails ??= new List(); + + return new CostInformation(billingMeterDetails?.ToList(), billingInfoUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Represents Billing type name. + /// + /// Represents MeterDetails. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Represents Metering type (eg one-time or recurrent). + /// Frequency of recurrence. + /// Represent Term Type details. + /// A new instance for mocking. + public static BillingMeterDetails BillingMeterDetails(string name = null, MeterDetails meterDetails = null, MeteringType? meteringType = null, string frequency = null, TermTypeDetails termTypeDetails = null) + { + return new BillingMeterDetails( + name, + meterDetails, + meteringType, + frequency, + termTypeDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Represents billing type. + /// Billing unit applicable for Pav2 billing. + /// Charging type. + /// A new instance for mocking. + public static MeterDetails MeterDetails(string billingType = null, double? multiplier = null, ChargingType? chargingType = null) + { + return new UnknownMeterDetails(billingType == null ? default : new BillingType(billingType), multiplier, chargingType, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -555,7 +613,7 @@ public static EdgeOrderItemReturnContent EdgeOrderItemReturnContent(EdgeOrderIte /// Charging type. /// Validation status of requested data center and transport. /// A new instance for mocking. - public static Pav2MeterDetails Pav2MeterDetails(double? multiplier = null, EdgeOrderProductChargingType? chargingType = null, Guid? meterGuid = null) + public static Pav2MeterDetails Pav2MeterDetails(double? multiplier = null, ChargingType? chargingType = null, string meterGuid = null) { return new Pav2MeterDetails(BillingType.Pav2, multiplier, chargingType, serializedAdditionalRawData: null, meterGuid); } @@ -567,7 +625,7 @@ public static Pav2MeterDetails Pav2MeterDetails(double? multiplier = null, EdgeO /// Sku Id. /// Term Id. /// A new instance for mocking. - public static PurchaseMeterDetails PurchaseMeterDetails(double? multiplier = null, EdgeOrderProductChargingType? chargingType = null, string productId = null, string skuId = null, string termId = null) + public static PurchaseMeterDetails PurchaseMeterDetails(double? multiplier = null, ChargingType? chargingType = null, string productId = null, string skuId = null, string termId = null) { return new PurchaseMeterDetails( BillingType.Purchase, @@ -578,5 +636,68 @@ public static PurchaseMeterDetails PurchaseMeterDetails(double? multiplier = nul skuId, termId); } + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Duration for the term type. + /// A new instance for mocking. + public static TermTypeDetails TermTypeDetails(TermCommitmentType termType = default, TimeSpan termTypeDuration = default) + { + return new TermTypeDetails(termType, termTypeDuration, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Current availability stage of the product. + /// Reason why the product is disabled. + /// Message for why the product is disabled. + /// A new instance for mocking. + public static AvailabilityInformation AvailabilityInformation(AvailabilityStage? availabilityStage = null, DisabledReason? disabledReason = null, string disabledReasonMessage = null) + { + return new AvailabilityInformation(availabilityStage, disabledReason, disabledReasonMessage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of product lines supported in the product family. + /// Contains details related to resource provider. + /// A new instance for mocking. + public static ProductFamily ProductFamily(IEnumerable productLines = null, IEnumerable resourceProviderDetails = null) + { + productLines ??= new List(); + resourceProviderDetails ??= new List(); + + return new ProductFamily(productLines?.ToList(), resourceProviderDetails?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of products in the product line. + /// A new instance for mocking. + public static ProductLine ProductLine(IEnumerable products = null) + { + products ??= new List(); + + return new ProductLine(products?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of configurations for the product. + /// A new instance for mocking. + public static Product Product(IEnumerable configurations = null) + { + configurations ??= new List(); + + return new Product(configurations?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of product lines supported in the product family. + /// Contains details related to resource provider. + /// A new instance for mocking. + public static ProductFamiliesMetadataDetails ProductFamiliesMetadataDetails(IEnumerable productLines = null, IEnumerable resourceProviderDetails = null) + { + productLines ??= new List(); + resourceProviderDetails ??= new List(); + + return new ProductFamiliesMetadataDetails(productLines?.ToList(), resourceProviderDetails?.ToList(), serializedAdditionalRawData: null); + } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.Serialization.cs deleted file mode 100644 index 1aeba0a6d0a5..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.EdgeOrder -{ - public partial class EdgeOrderAddressResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - EdgeOrderAddressData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); - - EdgeOrderAddressData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.Serialization.cs deleted file mode 100644 index 6c2edaa8c752..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.EdgeOrder -{ - public partial class EdgeOrderItemResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - EdgeOrderItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); - - EdgeOrderItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.Serialization.cs deleted file mode 100644 index d6700b262008..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.EdgeOrder -{ - public partial class EdgeOrderResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - EdgeOrderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); - - EdgeOrderData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs index 1b87424fde9a..45314036ceef 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs @@ -34,81 +34,81 @@ private static MockableEdgeOrderSubscriptionResource GetMockableEdgeOrderSubscri } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static EdgeOrderAddressResource GetEdgeOrderAddressResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static AddressResource GetAddressResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableEdgeOrderArmClient(client).GetEdgeOrderAddressResource(id); + return GetMockableEdgeOrderArmClient(client).GetAddressResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static EdgeOrderResource GetEdgeOrderResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static OrderItemResource GetOrderItemResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableEdgeOrderArmClient(client).GetEdgeOrderResource(id); + return GetMockableEdgeOrderArmClient(client).GetOrderItemResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static EdgeOrderItemResource GetEdgeOrderItemResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static OrderResource GetOrderResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableEdgeOrderArmClient(client).GetEdgeOrderItemResource(id); + return GetMockableEdgeOrderArmClient(client).GetOrderResource(id); } /// - /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. + /// Gets a collection of AddressResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of EdgeOrderAddressResources and their operations over a EdgeOrderAddressResource. - public static EdgeOrderAddressCollection GetEdgeOrderAddresses(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of AddressResources and their operations over a AddressResource. + public static AddressResourceCollection GetAddressResources(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddresses(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetAddressResources(); } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -116,20 +116,20 @@ public static EdgeOrderAddressCollection GetEdgeOrderAddresses(this ResourceGrou /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -138,15 +138,15 @@ public static EdgeOrderAddressCollection GetEdgeOrderAddresses(this ResourceGrou /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetEdgeOrderAddressAsync(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) + public static async Task> GetAddressResourceAsync(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddressAsync(addressName, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetAddressResourceAsync(addressName, cancellationToken).ConfigureAwait(false); } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -154,20 +154,20 @@ public static async Task> GetEdgeOrderAddress /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -176,205 +176,205 @@ public static async Task> GetEdgeOrderAddress /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetEdgeOrderAddress(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) + public static Response GetAddressResource(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddress(addressName, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetAddressResource(addressName, cancellationToken); } /// - /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. + /// Gets a collection of OrderItemResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of EdgeOrderResources and their operations over a EdgeOrderResource. - public static EdgeOrderCollection GetEdgeOrders(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of OrderItemResources and their operations over a OrderItemResource. + public static OrderItemResourceCollection GetOrderItemResources(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrders(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderItemResources(); } /// - /// Gets an order. + /// Get an order item. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} /// /// /// Operation Id - /// GetOrderByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of Azure region. - /// The name of the order. + /// The name of the order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetEdgeOrderAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public static async Task> GetOrderItemResourceAsync(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAsync(location, orderName, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderItemResourceAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Gets an order. + /// Get an order item. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} /// /// /// Operation Id - /// GetOrderByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of Azure region. - /// The name of the order. + /// The name of the order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetEdgeOrder(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public static Response GetOrderItemResource(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrder(location, orderName, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderItemResource(orderItemName, expand, cancellationToken); } /// - /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. + /// Gets a collection of OrderResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of EdgeOrderItemResources and their operations over a EdgeOrderItemResource. - public static EdgeOrderItemCollection GetEdgeOrderItems(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of OrderResources and their operations over a OrderResource. + public static OrderResourceCollection GetOrderResources(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItems(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderResources(); } /// - /// Gets an order item. + /// Get an order. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} /// /// /// Operation Id - /// GetOrderItemByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The name of the Azure region. + /// The name of the order. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetEdgeOrderItemAsync(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public static async Task> GetOrderResourceAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItemAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderResourceAsync(location, orderName, cancellationToken).ConfigureAwait(false); } /// - /// Gets an order item. + /// Get an order. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} /// /// /// Operation Id - /// GetOrderItemByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The name of the Azure region. + /// The name of the order. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetEdgeOrderItem(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public static Response GetOrderResource(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItem(orderItemName, expand, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderResource(location, orderName, cancellationToken); } /// - /// Lists order at resource group level. + /// List orders at resource group level. /// /// /// Request Path @@ -382,32 +382,33 @@ public static Response GetEdgeOrderItem(this ResourceGrou /// /// /// Operation Id - /// ListOrderAtResourceGroupLevel + /// OrdersOperationGroup_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEdgeOrdersAsync(this ResourceGroupResource resourceGroupResource, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOrderResourcesAsync(this ResourceGroupResource resourceGroupResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrdersAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderResourcesAsync(skipToken, top, cancellationToken); } /// - /// Lists order at resource group level. + /// List orders at resource group level. /// /// /// Request Path @@ -415,32 +416,33 @@ public static AsyncPageable GetEdgeOrdersAsync(this ResourceG /// /// /// Operation Id - /// ListOrderAtResourceGroupLevel + /// OrdersOperationGroup_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEdgeOrders(this ResourceGroupResource resourceGroupResource, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOrderResources(this ResourceGroupResource resourceGroupResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrders(skipToken, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetOrderResources(skipToken, top, cancellationToken); } /// - /// Lists all the addresses available under the subscription. + /// List all the addresses available under the subscription. /// /// /// Request Path @@ -448,37 +450,38 @@ public static Pageable GetEdgeOrders(this ResourceGroupResour /// /// /// Operation Id - /// ListAddressesAtSubscriptionLevel + /// AddressResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEdgeOrderAddressesAsync(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAddressResourcesAsync(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderAddressesAsync(filter, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetAddressResourcesAsync(filter, skipToken, top, cancellationToken); } /// - /// Lists all the addresses available under the subscription. + /// List all the addresses available under the subscription. /// /// /// Request Path @@ -486,107 +489,118 @@ public static AsyncPageable GetEdgeOrderAddressesAsync /// /// /// Operation Id - /// ListAddressesAtSubscriptionLevel + /// AddressResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEdgeOrderAddresses(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAddressResources(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderAddresses(filter, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetAddressResources(filter, skipToken, top, cancellationToken); } /// - /// This method provides the list of product families for the given subscription. + /// List order items at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems /// /// /// Operation Id - /// ListProductFamilies + /// OrderItemResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetProductFamiliesAsync(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOrderItemResourcesAsync(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesAsync(content, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetOrderItemResourcesAsync(filter, expand, skipToken, top, cancellationToken); } /// - /// This method provides the list of product families for the given subscription. + /// List order items at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems /// /// /// Operation Id - /// ListProductFamilies + /// OrderItemResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetProductFamilies(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOrderItemResources(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamilies(content, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetOrderItemResources(filter, expand, skipToken, top, cancellationToken); } /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// List configurations for the given product family, product line and product for the given subscription. /// /// /// Request Path @@ -594,16 +608,16 @@ public static Pageable GetProductFamilies(this SubscriptionResour /// /// /// Operation Id - /// ListConfigurations + /// ProductsAndConfigurationsOperationGroup_ListConfigurations /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -611,16 +625,16 @@ public static Pageable GetProductFamilies(this SubscriptionResour /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. /// The cancellation token to use. /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetConfigurationsAsync(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetConfigurationsProductsAndConfigurationsOperationGroupsAsync(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurationsAsync(content, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurationsProductsAndConfigurationsOperationGroupsAsync(content, skipToken, cancellationToken); } /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// List configurations for the given product family, product line and product for the given subscription. /// /// /// Request Path @@ -628,16 +642,16 @@ public static AsyncPageable GetConfigurationsAsync(this Su /// /// /// Operation Id - /// ListConfigurations + /// ProductsAndConfigurationsOperationGroup_ListConfigurations /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -645,222 +659,216 @@ public static AsyncPageable GetConfigurationsAsync(this Su /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. /// The cancellation token to use. /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetConfigurations(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetConfigurationsProductsAndConfigurationsOperationGroups(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurations(content, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurationsProductsAndConfigurationsOperationGroups(content, skipToken, cancellationToken); } /// - /// This method provides the list of product families metadata for the given subscription. + /// List product families for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies /// /// /// Operation Id - /// ListProductFamiliesMetadata + /// ProductsAndConfigurationsOperationGroup_ListProductFamilies /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetProductFamiliesMetadataAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetProductFamiliesProductsAndConfigurationsOperationGroupsAsync(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadataAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesProductsAndConfigurationsOperationGroupsAsync(content, expand, skipToken, cancellationToken); } /// - /// This method provides the list of product families metadata for the given subscription. + /// List product families for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies /// /// /// Operation Id - /// ListProductFamiliesMetadata + /// ProductsAndConfigurationsOperationGroup_ListProductFamilies /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetProductFamiliesMetadata(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetProductFamiliesProductsAndConfigurationsOperationGroups(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadata(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesProductsAndConfigurationsOperationGroups(content, expand, skipToken, cancellationToken); } /// - /// Lists order at subscription level. + /// List product families metadata for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata /// /// /// Operation Id - /// ListOrderAtSubscriptionLevel + /// ProductsAndConfigurationsOperationGroup_ListProductFamiliesMetadata /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEdgeOrdersAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetProductFamiliesMetadataProductsAndConfigurationsOperationGroupsAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrdersAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadataProductsAndConfigurationsOperationGroupsAsync(skipToken, cancellationToken); } /// - /// Lists order at subscription level. + /// List product families metadata for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata /// /// /// Operation Id - /// ListOrderAtSubscriptionLevel + /// ProductsAndConfigurationsOperationGroup_ListProductFamiliesMetadata /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEdgeOrders(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrders(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups(skipToken, cancellationToken); } /// - /// Lists order item at subscription level. + /// List orders at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders /// /// /// Operation Id - /// ListOrderItemsAtSubscriptionLevel + /// OrdersOperationGroup_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 - /// - /// - /// Resource - /// + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetEdgeOrderItemsAsync(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOrderResourcesAsync(this SubscriptionResource subscriptionResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderItemsAsync(filter, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetOrderResourcesAsync(skipToken, top, cancellationToken); } /// - /// Lists order item at subscription level. + /// List orders at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders /// /// /// Operation Id - /// ListOrderItemsAtSubscriptionLevel + /// OrdersOperationGroup_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 - /// - /// - /// Resource - /// + /// 2024-02-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetEdgeOrderItems(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOrderResources(this SubscriptionResource subscriptionResource, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderItems(filter, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetOrderResources(skipToken, top, cancellationToken); } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs index 3d340c106ffb..0e35d3976668 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs @@ -35,39 +35,39 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual EdgeOrderAddressResource GetEdgeOrderAddressResource(ResourceIdentifier id) + /// Returns a object. + public virtual AddressResource GetAddressResource(ResourceIdentifier id) { - EdgeOrderAddressResource.ValidateResourceId(id); - return new EdgeOrderAddressResource(Client, id); + AddressResource.ValidateResourceId(id); + return new AddressResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual EdgeOrderResource GetEdgeOrderResource(ResourceIdentifier id) + /// Returns a object. + public virtual OrderItemResource GetOrderItemResource(ResourceIdentifier id) { - EdgeOrderResource.ValidateResourceId(id); - return new EdgeOrderResource(Client, id); + OrderItemResource.ValidateResourceId(id); + return new OrderItemResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual EdgeOrderItemResource GetEdgeOrderItemResource(ResourceIdentifier id) + /// Returns a object. + public virtual OrderResource GetOrderResource(ResourceIdentifier id) { - EdgeOrderItemResource.ValidateResourceId(id); - return new EdgeOrderItemResource(Client, id); + OrderResource.ValidateResourceId(id); + return new OrderResource(Client, id); } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs index 3d6a55411ddd..8dac17932a85 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs @@ -17,8 +17,8 @@ namespace Azure.ResourceManager.EdgeOrder.Mocking /// A class to add extension methods to ResourceGroupResource. public partial class MockableEdgeOrderResourceGroupResource : ArmResource { - private ClientDiagnostics _defaultClientDiagnostics; - private EdgeOrderManagementRestOperations _defaultRestClient; + private ClientDiagnostics _ordersOperationGroupClientDiagnostics; + private OrdersOperationGroupRestOperations _ordersOperationGroupRestClient; /// Initializes a new instance of the class for mocking. protected MockableEdgeOrderResourceGroupResource() @@ -32,8 +32,8 @@ internal MockableEdgeOrderResourceGroupResource(ArmClient client, ResourceIdenti { } - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics OrdersOperationGroupClientDiagnostics => _ordersOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OrdersOperationGroupRestOperations OrdersOperationGroupRestClient => _ordersOperationGroupRestClient ??= new OrdersOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -41,15 +41,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderAddressResources and their operations over a EdgeOrderAddressResource. - public virtual EdgeOrderAddressCollection GetEdgeOrderAddresses() + /// Gets a collection of AddressResources in the ResourceGroupResource. + /// An object representing collection of AddressResources and their operations over a AddressResource. + public virtual AddressResourceCollection GetAddressResources() { - return GetCachedClient(client => new EdgeOrderAddressCollection(client, Id)); + return GetCachedClient(client => new AddressResourceCollection(client, Id)); } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -57,15 +57,15 @@ public virtual EdgeOrderAddressCollection GetEdgeOrderAddresses() /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -74,13 +74,13 @@ public virtual EdgeOrderAddressCollection GetEdgeOrderAddresses() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetEdgeOrderAddressAsync(string addressName, CancellationToken cancellationToken = default) + public virtual async Task> GetAddressResourceAsync(string addressName, CancellationToken cancellationToken = default) { - return await GetEdgeOrderAddresses().GetAsync(addressName, cancellationToken).ConfigureAwait(false); + return await GetAddressResources().GetAsync(addressName, cancellationToken).ConfigureAwait(false); } /// - /// Gets information about the specified address. + /// Get information about the specified address. /// /// /// Request Path @@ -88,15 +88,15 @@ public virtual async Task> GetEdgeOrderAddres /// /// /// Operation Id - /// GetAddressByName + /// AddressResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -105,155 +105,155 @@ public virtual async Task> GetEdgeOrderAddres /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetEdgeOrderAddress(string addressName, CancellationToken cancellationToken = default) + public virtual Response GetAddressResource(string addressName, CancellationToken cancellationToken = default) { - return GetEdgeOrderAddresses().Get(addressName, cancellationToken); + return GetAddressResources().Get(addressName, cancellationToken); } - /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderResources and their operations over a EdgeOrderResource. - public virtual EdgeOrderCollection GetEdgeOrders() + /// Gets a collection of OrderItemResources in the ResourceGroupResource. + /// An object representing collection of OrderItemResources and their operations over a OrderItemResource. + public virtual OrderItemResourceCollection GetOrderItemResources() { - return GetCachedClient(client => new EdgeOrderCollection(client, Id)); + return GetCachedClient(client => new OrderItemResourceCollection(client, Id)); } /// - /// Gets an order. + /// Get an order item. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} /// /// /// Operation Id - /// GetOrderByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. - /// The name of the order. + /// The name of the order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetEdgeOrderAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual async Task> GetOrderItemResourceAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { - return await GetEdgeOrders().GetAsync(location, orderName, cancellationToken).ConfigureAwait(false); + return await GetOrderItemResources().GetAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Gets an order. + /// Get an order item. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} /// /// /// Operation Id - /// GetOrderByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. - /// The name of the order. + /// The name of the order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetEdgeOrder(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual Response GetOrderItemResource(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { - return GetEdgeOrders().Get(location, orderName, cancellationToken); + return GetOrderItemResources().Get(orderItemName, expand, cancellationToken); } - /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderItemResources and their operations over a EdgeOrderItemResource. - public virtual EdgeOrderItemCollection GetEdgeOrderItems() + /// Gets a collection of OrderResources in the ResourceGroupResource. + /// An object representing collection of OrderResources and their operations over a OrderResource. + public virtual OrderResourceCollection GetOrderResources() { - return GetCachedClient(client => new EdgeOrderItemCollection(client, Id)); + return GetCachedClient(client => new OrderResourceCollection(client, Id)); } /// - /// Gets an order item. + /// Get an order. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} /// /// /// Operation Id - /// GetOrderItemByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The name of the Azure region. + /// The name of the order. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetEdgeOrderItemAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetOrderResourceAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { - return await GetEdgeOrderItems().GetAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); + return await GetOrderResources().GetAsync(location, orderName, cancellationToken).ConfigureAwait(false); } /// - /// Gets an order item. + /// Get an order. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} /// /// /// Operation Id - /// GetOrderItemByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The name of the Azure region. + /// The name of the order. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetEdgeOrderItem(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual Response GetOrderResource(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { - return GetEdgeOrderItems().Get(orderItemName, expand, cancellationToken); + return GetOrderResources().Get(location, orderName, cancellationToken); } /// - /// Lists order at resource group level. + /// List orders at resource group level. /// /// /// Request Path @@ -261,26 +261,27 @@ public virtual Response GetEdgeOrderItem(string orderItem /// /// /// Operation Id - /// ListOrderAtResourceGroupLevel + /// OrdersOperationGroup_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOrderResourcesAsync(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrdersOperationGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrdersOperationGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrderResource(Client, OrderResourceData.DeserializeOrderResourceData(e)), OrdersOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetOrderResources", "value", "nextLink", cancellationToken); } /// - /// Lists order at resource group level. + /// List orders at resource group level. /// /// /// Request Path @@ -288,22 +289,23 @@ public virtual AsyncPageable GetEdgeOrdersAsync(string skipTo /// /// /// Operation Id - /// ListOrderAtResourceGroupLevel + /// OrdersOperationGroup_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOrderResources(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrdersOperationGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrdersOperationGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrderResource(Client, OrderResourceData.DeserializeOrderResourceData(e)), OrdersOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetOrderResources", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs index 22dc0aba5c17..ccc88e3e765d 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs @@ -17,12 +17,14 @@ namespace Azure.ResourceManager.EdgeOrder.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableEdgeOrderSubscriptionResource : ArmResource { - private ClientDiagnostics _edgeOrderAddressClientDiagnostics; - private EdgeOrderManagementRestOperations _edgeOrderAddressRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private EdgeOrderManagementRestOperations _defaultRestClient; - private ClientDiagnostics _edgeOrderItemClientDiagnostics; - private EdgeOrderManagementRestOperations _edgeOrderItemRestClient; + private ClientDiagnostics _addressResourceClientDiagnostics; + private AddressResourcesRestOperations _addressResourceRestClient; + private ClientDiagnostics _orderItemResourceClientDiagnostics; + private OrderItemResourcesRestOperations _orderItemResourceRestClient; + private ClientDiagnostics _productsAndConfigurationsOperationGroupClientDiagnostics; + private ProductsAndConfigurationsOperationGroupRestOperations _productsAndConfigurationsOperationGroupRestClient; + private ClientDiagnostics _ordersOperationGroupClientDiagnostics; + private OrdersOperationGroupRestOperations _ordersOperationGroupRestClient; /// Initializes a new instance of the class for mocking. protected MockableEdgeOrderSubscriptionResource() @@ -36,12 +38,14 @@ internal MockableEdgeOrderSubscriptionResource(ArmClient client, ResourceIdentif { } - private ClientDiagnostics EdgeOrderAddressClientDiagnostics => _edgeOrderAddressClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderAddressResource.ResourceType.Namespace, Diagnostics); - private EdgeOrderManagementRestOperations EdgeOrderAddressRestClient => _edgeOrderAddressRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderAddressResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics EdgeOrderItemClientDiagnostics => _edgeOrderItemClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderItemResource.ResourceType.Namespace, Diagnostics); - private EdgeOrderManagementRestOperations EdgeOrderItemRestClient => _edgeOrderItemRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderItemResource.ResourceType)); + private ClientDiagnostics AddressResourceClientDiagnostics => _addressResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", AddressResource.ResourceType.Namespace, Diagnostics); + private AddressResourcesRestOperations AddressResourceRestClient => _addressResourceRestClient ??= new AddressResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AddressResource.ResourceType)); + private ClientDiagnostics OrderItemResourceClientDiagnostics => _orderItemResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", OrderItemResource.ResourceType.Namespace, Diagnostics); + private OrderItemResourcesRestOperations OrderItemResourceRestClient => _orderItemResourceRestClient ??= new OrderItemResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OrderItemResource.ResourceType)); + private ClientDiagnostics ProductsAndConfigurationsOperationGroupClientDiagnostics => _productsAndConfigurationsOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ProductsAndConfigurationsOperationGroupRestOperations ProductsAndConfigurationsOperationGroupRestClient => _productsAndConfigurationsOperationGroupRestClient ??= new ProductsAndConfigurationsOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics OrdersOperationGroupClientDiagnostics => _ordersOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OrdersOperationGroupRestOperations OrdersOperationGroupRestClient => _ordersOperationGroupRestClient ??= new OrdersOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -50,7 +54,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Lists all the addresses available under the subscription. + /// List all the addresses available under the subscription. /// /// /// Request Path @@ -58,31 +62,32 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Operation Id - /// ListAddressesAtSubscriptionLevel + /// AddressResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrderAddressesAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAddressResourcesAsync(string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => AddressResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AddressResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AddressResource(Client, AddressResourceData.DeserializeAddressResourceData(e)), AddressResourceClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetAddressResources", "value", "nextLink", cancellationToken); } /// - /// Lists all the addresses available under the subscription. + /// List all the addresses available under the subscription. /// /// /// Request Path @@ -90,95 +95,100 @@ public virtual AsyncPageable GetEdgeOrderAddressesAsyn /// /// /// Operation Id - /// ListAddressesAtSubscriptionLevel + /// AddressResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrderAddresses(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAddressResources(string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => AddressResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AddressResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AddressResource(Client, AddressResourceData.DeserializeAddressResourceData(e)), AddressResourceClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetAddressResources", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of product families for the given subscription. + /// List order items at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems /// /// /// Operation Id - /// ListProductFamilies + /// OrderItemResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 + /// + /// + /// Resource + /// /// /// /// - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProductFamiliesAsync(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOrderItemResourcesAsync(string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProductFamily.DeserializeProductFamily(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamilies", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrderItemResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, expand, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrderItemResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrderItemResource(Client, OrderItemResourceData.DeserializeOrderItemResourceData(e)), OrderItemResourceClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetOrderItemResources", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of product families for the given subscription. + /// List order items at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems /// /// /// Operation Id - /// ListProductFamilies + /// OrderItemResource_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 + /// + /// + /// Resource + /// /// /// /// - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProductFamilies(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOrderItemResources(string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProductFamily.DeserializeProductFamily(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamilies", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrderItemResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, expand, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrderItemResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrderItemResource(Client, OrderItemResourceData.DeserializeOrderItemResourceData(e)), OrderItemResourceClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetOrderItemResources", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// List configurations for the given product family, product line and product for the given subscription. /// /// /// Request Path @@ -186,11 +196,11 @@ public virtual Pageable GetProductFamilies(ProductFamiliesContent /// /// /// Operation Id - /// ListConfigurations + /// ProductsAndConfigurationsOperationGroup_ListConfigurations /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// @@ -198,18 +208,18 @@ public virtual Pageable GetProductFamilies(ProductFamiliesContent /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationsAsync(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationsProductsAndConfigurationsOperationGroupsAsync(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProductConfiguration.DeserializeProductConfiguration(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Configuration.DeserializeConfiguration(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurationsProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// List configurations for the given product family, product line and product for the given subscription. /// /// /// Request Path @@ -217,11 +227,11 @@ public virtual AsyncPageable GetConfigurationsAsync(Config /// /// /// Operation Id - /// ListConfigurations + /// ProductsAndConfigurationsOperationGroup_ListConfigurations /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// @@ -229,188 +239,188 @@ public virtual AsyncPageable GetConfigurationsAsync(Config /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurations(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationsProductsAndConfigurationsOperationGroups(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProductConfiguration.DeserializeProductConfiguration(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Configuration.DeserializeConfiguration(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurationsProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of product families metadata for the given subscription. + /// List product families for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies /// /// /// Operation Id - /// ListProductFamiliesMetadata + /// ProductsAndConfigurationsOperationGroup_ListProductFamilies /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProductFamiliesMetadataAsync(string skipToken = null, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProductFamiliesProductsAndConfigurationsOperationGroupsAsync(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProductFamily.DeserializeProductFamily(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// This method provides the list of product families metadata for the given subscription. + /// List product families for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies /// /// /// Operation Id - /// ListProductFamiliesMetadata + /// ProductsAndConfigurationsOperationGroup_ListProductFamilies /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProductFamiliesMetadata(string skipToken = null, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProductFamiliesProductsAndConfigurationsOperationGroups(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(e), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProductFamily.DeserializeProductFamily(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// Lists order at subscription level. + /// List product families metadata for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata /// /// /// Operation Id - /// ListOrderAtSubscriptionLevel + /// ProductsAndConfigurationsOperationGroup_ListProductFamiliesMetadata /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProductFamiliesMetadataProductsAndConfigurationsOperationGroupsAsync(string skipToken = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProductFamiliesMetadataDetails.DeserializeProductFamiliesMetadataDetails(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// Lists order at subscription level. + /// List product families metadata for the given subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata /// /// /// Operation Id - /// ListOrderAtSubscriptionLevel + /// ProductsAndConfigurationsOperationGroup_ListProductFamiliesMetadata /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups(string skipToken = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProductsAndConfigurationsOperationGroupRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProductFamiliesMetadataDetails.DeserializeProductFamiliesMetadataDetails(e), ProductsAndConfigurationsOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadataProductsAndConfigurationsOperationGroups", "value", "nextLink", cancellationToken); } /// - /// Lists order item at subscription level. + /// List orders at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders /// /// /// Operation Id - /// ListOrderItemsAtSubscriptionLevel + /// OrdersOperationGroup_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 - /// - /// - /// Resource - /// + /// 2024-02-01 /// /// /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrderItemsAsync(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOrderResourcesAsync(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderItems", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrdersOperationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrdersOperationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrderResource(Client, OrderResourceData.DeserializeOrderResourceData(e)), OrdersOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetOrderResources", "value", "nextLink", cancellationToken); } /// - /// Lists order item at subscription level. + /// List orders at subscription level. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders /// /// /// Operation Id - /// ListOrderItemsAtSubscriptionLevel + /// OrdersOperationGroup_ListBySubscription /// /// /// Default Api Version - /// 2021-12-01 - /// - /// - /// Resource - /// + /// 2024-02-01 /// /// /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrderItems(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOrderResources(string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderItems", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => OrdersOperationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrdersOperationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrderResource(Client, OrderResourceData.DeserializeOrderResourceData(e)), OrdersOperationGroupClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetOrderResources", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/AddressResourceOperationSource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/AddressResourceOperationSource.cs new file mode 100644 index 000000000000..a391420902bf --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/AddressResourceOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal class AddressResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AddressResourceOperationSource(ArmClient client) + { + _client = client; + } + + AddressResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); + return new AddressResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); + return await Task.FromResult(new AddressResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderAddressOperationSource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderAddressOperationSource.cs deleted file mode 100644 index c9eab09fc653..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderAddressOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.EdgeOrder -{ - internal class EdgeOrderAddressOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal EdgeOrderAddressOperationSource(ArmClient client) - { - _client = client; - } - - EdgeOrderAddressResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); - return new EdgeOrderAddressResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); - return await Task.FromResult(new EdgeOrderAddressResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderItemOperationSource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderItemOperationSource.cs deleted file mode 100644 index e4335b1f1ffc..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/EdgeOrderItemOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.EdgeOrder -{ - internal class EdgeOrderItemOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal EdgeOrderItemOperationSource(ArmClient client) - { - _client = client; - } - - EdgeOrderItemResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); - return new EdgeOrderItemResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); - return await Task.FromResult(new EdgeOrderItemResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OkResponseOperationSource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OkResponseOperationSource.cs new file mode 100644 index 000000000000..c1c2b5497473 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OkResponseOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal class OkResponseOperationSource : IOperationSource + { + OkResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return OkResponse.DeserializeOkResponse(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return OkResponse.DeserializeOkResponse(document.RootElement); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OrderItemResourceOperationSource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OrderItemResourceOperationSource.cs new file mode 100644 index 000000000000..6038ba0887c9 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/LongRunningOperation/OrderItemResourceOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal class OrderItemResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal OrderItemResourceOperationSource(ArmClient client) + { + _client = client; + } + + OrderItemResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); + return new OrderItemResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerEdgeOrderContext.Default); + return await Task.FromResult(new OrderItemResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ActionStatusEnum.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ActionStatusEnum.cs new file mode 100644 index 000000000000..9e9fcbc7b345 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ActionStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Describes whether the order item is deletable or not. + public readonly partial struct ActionStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActionStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowedValue = "Allowed"; + private const string NotAllowedValue = "NotAllowed"; + + /// Allowed flag. + public static ActionStatusEnum Allowed { get; } = new ActionStatusEnum(AllowedValue); + /// Not Allowed flag. + public static ActionStatusEnum NotAllowed { get; } = new ActionStatusEnum(NotAllowedValue); + /// Determines if two values are the same. + public static bool operator ==(ActionStatusEnum left, ActionStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActionStatusEnum left, ActionStatusEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ActionStatusEnum(string value) => new ActionStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActionStatusEnum other && Equals(other); + /// + public bool Equals(ActionStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.Serialization.cs new file mode 100644 index 000000000000..96442b51f77b --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class AdditionalConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdditionalConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("hierarchyInformation"u8); + writer.WriteObjectValue(HierarchyInformation, options); + writer.WritePropertyName("quantity"u8); + writer.WriteNumberValue(Quantity); + if (Optional.IsCollectionDefined(ProvisioningDetails)) + { + writer.WritePropertyName("provisioningDetails"u8); + writer.WriteStartArray(); + foreach (var item in ProvisioningDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdditionalConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdditionalConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdditionalConfiguration(document.RootElement, options); + } + + internal static AdditionalConfiguration DeserializeAdditionalConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HierarchyInformation hierarchyInformation = default; + int quantity = default; + IList provisioningDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hierarchyInformation"u8)) + { + hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property.Value, options); + continue; + } + if (property.NameEquals("quantity"u8)) + { + quantity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.ProvisioningDetails.DeserializeProvisioningDetails(item, options)); + } + provisioningDetails = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdditionalConfiguration(hierarchyInformation, quantity, provisioningDetails ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(AdditionalConfiguration)} does not support writing '{options.Format}' format."); + } + } + + AdditionalConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAdditionalConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdditionalConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.cs new file mode 100644 index 000000000000..fbac51fb6436 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AdditionalConfiguration.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Additional Configuration details. + public partial class AdditionalConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Hierarchy of the product which uniquely identifies the configuration. + /// Quantity of the product. + /// is null. + public AdditionalConfiguration(HierarchyInformation hierarchyInformation, int quantity) + { + Argument.AssertNotNull(hierarchyInformation, nameof(hierarchyInformation)); + + HierarchyInformation = hierarchyInformation; + Quantity = quantity; + ProvisioningDetails = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Hierarchy of the product which uniquely identifies the configuration. + /// Quantity of the product. + /// List Provisioning Details for Devices in Additional Config. + /// Keeps track of any properties unknown to the library. + internal AdditionalConfiguration(HierarchyInformation hierarchyInformation, int quantity, IList provisioningDetails, IDictionary serializedAdditionalRawData) + { + HierarchyInformation = hierarchyInformation; + Quantity = quantity; + ProvisioningDetails = provisioningDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AdditionalConfiguration() + { + } + + /// Hierarchy of the product which uniquely identifies the configuration. + public HierarchyInformation HierarchyInformation { get; set; } + /// Quantity of the product. + public int Quantity { get; set; } + /// List Provisioning Details for Devices in Additional Config. + public IList ProvisioningDetails { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressClassification.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressClassification.cs new file mode 100644 index 000000000000..ee66919b1c76 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressClassification.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Type of address based on its usage context. + public readonly partial struct AddressClassification : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddressClassification(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ShippingValue = "Shipping"; + private const string SiteValue = "Site"; + + /// Shipping address for the order. + public static AddressClassification Shipping { get; } = new AddressClassification(ShippingValue); + /// Site Address. + public static AddressClassification Site { get; } = new AddressClassification(SiteValue); + /// Determines if two values are the same. + public static bool operator ==(AddressClassification left, AddressClassification right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddressClassification left, AddressClassification right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AddressClassification(string value) => new AddressClassification(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddressClassification other && Equals(other); + /// + public bool Equals(AddressClassification other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.Serialization.cs similarity index 61% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.Serialization.cs index fc4fa7fd6671..d3dcb0310eae 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemAddressDetails : IUtf8JsonSerializable, IJsonModel + public partial class AddressDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemAddressDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AddressDetails)} does not support writing '{format}' format."); } writer.WritePropertyName("forwardAddress"u8); @@ -58,19 +58,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemAddressDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AddressDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemAddressDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AddressDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemAddressDetails(document.RootElement, options); + return DeserializeAddressDetails(document.RootElement, options); } - internal static EdgeOrderItemAddressDetails DeserializeEdgeOrderItemAddressDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static AddressDetails DeserializeAddressDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -78,15 +78,15 @@ internal static EdgeOrderItemAddressDetails DeserializeEdgeOrderItemAddressDetai { return null; } - EdgeOrderItemAddressProperties forwardAddress = default; - EdgeOrderItemAddressProperties returnAddress = default; + AddressProperties forwardAddress = default; + AddressProperties returnAddress = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("forwardAddress"u8)) { - forwardAddress = EdgeOrderItemAddressProperties.DeserializeEdgeOrderItemAddressProperties(property.Value, options); + forwardAddress = AddressProperties.DeserializeAddressProperties(property.Value, options); continue; } if (property.NameEquals("returnAddress"u8)) @@ -95,7 +95,7 @@ internal static EdgeOrderItemAddressDetails DeserializeEdgeOrderItemAddressDetai { continue; } - returnAddress = EdgeOrderItemAddressProperties.DeserializeEdgeOrderItemAddressProperties(property.Value, options); + returnAddress = AddressProperties.DeserializeAddressProperties(property.Value, options); continue; } if (options.Format != "W") @@ -104,38 +104,38 @@ internal static EdgeOrderItemAddressDetails DeserializeEdgeOrderItemAddressDetai } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemAddressDetails(forwardAddress, returnAddress, serializedAdditionalRawData); + return new AddressDetails(forwardAddress, returnAddress, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemAddressDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemAddressDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AddressDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemAddressDetails(document.RootElement, options); + return DeserializeAddressDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemAddressDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.cs similarity index 71% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.cs index 068b99696259..e972ab3768a5 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Address details for an order item. - public partial class EdgeOrderItemAddressDetails + public partial class AddressDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,35 +45,35 @@ public partial class EdgeOrderItemAddressDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Customer address and contact details. It should be address resource. + /// Initializes a new instance of . + /// Customer address and contact details. /// is null. - public EdgeOrderItemAddressDetails(EdgeOrderItemAddressProperties forwardAddress) + public AddressDetails(AddressProperties forwardAddress) { Argument.AssertNotNull(forwardAddress, nameof(forwardAddress)); ForwardAddress = forwardAddress; } - /// Initializes a new instance of . - /// Customer address and contact details. It should be address resource. + /// Initializes a new instance of . + /// Customer address and contact details. /// Return shipping address. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemAddressDetails(EdgeOrderItemAddressProperties forwardAddress, EdgeOrderItemAddressProperties returnAddress, IDictionary serializedAdditionalRawData) + internal AddressDetails(AddressProperties forwardAddress, AddressProperties returnAddress, IDictionary serializedAdditionalRawData) { ForwardAddress = forwardAddress; ReturnAddress = returnAddress; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemAddressDetails() + /// Initializes a new instance of for deserialization. + internal AddressDetails() { } - /// Customer address and contact details. It should be address resource. - public EdgeOrderItemAddressProperties ForwardAddress { get; set; } + /// Customer address and contact details. + public AddressProperties ForwardAddress { get; set; } /// Return shipping address. - public EdgeOrderItemAddressProperties ReturnAddress { get; } + public AddressProperties ReturnAddress { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.Serialization.cs new file mode 100644 index 000000000000..2cec20d39bbf --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class AddressProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AddressProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AddressClassification)) + { + writer.WritePropertyName("addressClassification"u8); + writer.WriteStringValue(AddressClassification.Value.ToString()); + } + if (Optional.IsDefined(ShippingAddress)) + { + writer.WritePropertyName("shippingAddress"u8); + writer.WriteObjectValue(ShippingAddress, options); + } + if (Optional.IsDefined(ContactDetails)) + { + writer.WritePropertyName("contactDetails"u8); + writer.WriteObjectValue(ContactDetails, options); + } + if (options.Format != "W" && Optional.IsDefined(AddressValidationStatus)) + { + writer.WritePropertyName("addressValidationStatus"u8); + writer.WriteStringValue(AddressValidationStatus.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AddressProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AddressProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAddressProperties(document.RootElement, options); + } + + internal static AddressProperties DeserializeAddressProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AddressClassification? addressClassification = default; + ShippingAddress shippingAddress = default; + ContactDetails contactDetails = default; + AddressValidationStatus? addressValidationStatus = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("addressClassification"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addressClassification = new AddressClassification(property.Value.GetString()); + continue; + } + if (property.NameEquals("shippingAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + shippingAddress = ShippingAddress.DeserializeShippingAddress(property.Value, options); + continue; + } + if (property.NameEquals("contactDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contactDetails = ContactDetails.DeserializeContactDetails(property.Value, options); + continue; + } + if (property.NameEquals("addressValidationStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addressValidationStatus = new AddressValidationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AddressProperties( + addressClassification, + shippingAddress, + contactDetails, + addressValidationStatus, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(AddressProperties)} does not support writing '{options.Format}' format."); + } + } + + AddressProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAddressProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AddressProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.cs similarity index 64% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.cs index f9e9ec1937e3..9b9a40d0aa96 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Address Properties. - public partial class EdgeOrderItemAddressProperties + public partial class AddressProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,39 +45,37 @@ public partial class EdgeOrderItemAddressProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Contact details for the address. - /// is null. - public EdgeOrderItemAddressProperties(EdgeOrderAddressContactDetails contactDetails) + /// Initializes a new instance of . + public AddressProperties() { - Argument.AssertNotNull(contactDetails, nameof(contactDetails)); - - ContactDetails = contactDetails; } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Type of address based on its usage context. /// Shipping details for the address. /// Contact details for the address. /// Status of address validation. + /// Provisioning state. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemAddressProperties(EdgeOrderShippingAddress shippingAddress, EdgeOrderAddressContactDetails contactDetails, EdgeOrderAddressValidationStatus? addressValidationStatus, IDictionary serializedAdditionalRawData) + internal AddressProperties(AddressClassification? addressClassification, ShippingAddress shippingAddress, ContactDetails contactDetails, AddressValidationStatus? addressValidationStatus, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) { + AddressClassification = addressClassification; ShippingAddress = shippingAddress; ContactDetails = contactDetails; AddressValidationStatus = addressValidationStatus; + ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemAddressProperties() - { - } - + /// Type of address based on its usage context. + public AddressClassification? AddressClassification { get; set; } /// Shipping details for the address. - public EdgeOrderShippingAddress ShippingAddress { get; set; } + public ShippingAddress ShippingAddress { get; set; } /// Contact details for the address. - public EdgeOrderAddressContactDetails ContactDetails { get; set; } + public ContactDetails ContactDetails { get; set; } /// Status of address validation. - public EdgeOrderAddressValidationStatus? AddressValidationStatus { get; } + public AddressValidationStatus? AddressValidationStatus { get; } + /// Provisioning state. + public ProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.Serialization.cs index d1774dac4a29..8cc02b154854 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(AddressResourceList)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -86,29 +86,29 @@ internal static AddressResourceList DeserializeAddressResourceList(JsonElement e { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderAddressData.DeserializeEdgeOrderAddressData(item, options)); + array.Add(AddressResourceData.DeserializeAddressResourceData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static AddressResourceList DeserializeAddressResourceList(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new AddressResourceList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new AddressResourceList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.cs index 24d2e31e8aa5..3517f51c6da3 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourceList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { @@ -46,25 +47,31 @@ internal partial class AddressResourceList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal AddressResourceList() + /// The AddressResource items on this page. + internal AddressResourceList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of address resources. - /// Link for the next set of job resources. + /// The AddressResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal AddressResourceList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal AddressResourceList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of address resources. - public IReadOnlyList Value { get; } - /// Link for the next set of job resources. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal AddressResourceList() + { + } + + /// The AddressResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.Serialization.cs similarity index 71% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.Serialization.cs index ed51c9c82fe2..20a54ce9f82d 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderAddressPatch : IUtf8JsonSerializable, IJsonModel + public partial class AddressResourcePatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AddressResourcePatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -75,19 +75,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderAddressPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AddressResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AddressResourcePatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderAddressPatch(document.RootElement, options); + return DeserializeAddressResourcePatch(document.RootElement, options); } - internal static EdgeOrderAddressPatch DeserializeEdgeOrderAddressPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static AddressResourcePatch DeserializeAddressResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -96,8 +96,8 @@ internal static EdgeOrderAddressPatch DeserializeEdgeOrderAddressPatch(JsonEleme return null; } IDictionary tags = default; - EdgeOrderShippingAddress shippingAddress = default; - EdgeOrderAddressContactDetails contactDetails = default; + ShippingAddress shippingAddress = default; + ContactDetails contactDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -131,7 +131,7 @@ internal static EdgeOrderAddressPatch DeserializeEdgeOrderAddressPatch(JsonEleme { continue; } - shippingAddress = EdgeOrderShippingAddress.DeserializeEdgeOrderShippingAddress(property0.Value, options); + shippingAddress = ShippingAddress.DeserializeShippingAddress(property0.Value, options); continue; } if (property0.NameEquals("contactDetails"u8)) @@ -140,7 +140,7 @@ internal static EdgeOrderAddressPatch DeserializeEdgeOrderAddressPatch(JsonEleme { continue; } - contactDetails = EdgeOrderAddressContactDetails.DeserializeEdgeOrderAddressContactDetails(property0.Value, options); + contactDetails = ContactDetails.DeserializeContactDetails(property0.Value, options); continue; } } @@ -152,38 +152,38 @@ internal static EdgeOrderAddressPatch DeserializeEdgeOrderAddressPatch(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderAddressPatch(tags ?? new ChangeTrackingDictionary(), shippingAddress, contactDetails, serializedAdditionalRawData); + return new AddressResourcePatch(shippingAddress, contactDetails, tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderAddressPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressResourcePatch)} does not support writing '{options.Format}' format."); } } - EdgeOrderAddressPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AddressResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderAddressPatch(document.RootElement, options); + return DeserializeAddressResourcePatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderAddressPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddressResourcePatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.cs similarity index 81% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.cs index 424c932b89e2..7f475ba025e6 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressPatch.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressResourcePatch.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// The Address update parameters. - public partial class EdgeOrderAddressPatch + public partial class AddressResourcePatch { /// /// Keeps track of any properties unknown to the library. @@ -45,30 +45,30 @@ public partial class EdgeOrderAddressPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public EdgeOrderAddressPatch() + /// Initializes a new instance of . + public AddressResourcePatch() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . - /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + /// Initializes a new instance of . /// Shipping details for the address. /// Contact details for the address. + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). /// Keeps track of any properties unknown to the library. - internal EdgeOrderAddressPatch(IDictionary tags, EdgeOrderShippingAddress shippingAddress, EdgeOrderAddressContactDetails contactDetails, IDictionary serializedAdditionalRawData) + internal AddressResourcePatch(ShippingAddress shippingAddress, ContactDetails contactDetails, IDictionary tags, IDictionary serializedAdditionalRawData) { - Tags = tags; ShippingAddress = shippingAddress; ContactDetails = contactDetails; + Tags = tags; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 IDictionary Tags { get; } /// Shipping details for the address. - public EdgeOrderShippingAddress ShippingAddress { get; set; } + public ShippingAddress ShippingAddress { get; set; } /// Contact details for the address. - public EdgeOrderAddressContactDetails ContactDetails { get; set; } + public ContactDetails ContactDetails { 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). + public IDictionary Tags { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressType.cs new file mode 100644 index 000000000000..8531d4b1156f --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Type of address. + public readonly partial struct AddressType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddressType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ResidentialValue = "Residential"; + private const string CommercialValue = "Commercial"; + + /// Address type not known. + public static AddressType None { get; } = new AddressType(NoneValue); + /// Residential Address. + public static AddressType Residential { get; } = new AddressType(ResidentialValue); + /// Commercial Address. + public static AddressType Commercial { get; } = new AddressType(CommercialValue); + /// Determines if two values are the same. + public static bool operator ==(AddressType left, AddressType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddressType left, AddressType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AddressType(string value) => new AddressType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddressType other && Equals(other); + /// + public bool Equals(AddressType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressValidationStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressValidationStatus.cs new file mode 100644 index 000000000000..da65600404e2 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AddressValidationStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Status of address validation. + public readonly partial struct AddressValidationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddressValidationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ValidValue = "Valid"; + private const string InvalidValue = "Invalid"; + private const string AmbiguousValue = "Ambiguous"; + + /// Address provided is valid. + public static AddressValidationStatus Valid { get; } = new AddressValidationStatus(ValidValue); + /// Address provided is invalid or not supported. + public static AddressValidationStatus Invalid { get; } = new AddressValidationStatus(InvalidValue); + /// Address provided is ambiguous, please choose one of the alternate addresses returned. + public static AddressValidationStatus Ambiguous { get; } = new AddressValidationStatus(AmbiguousValue); + /// Determines if two values are the same. + public static bool operator ==(AddressValidationStatus left, AddressValidationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddressValidationStatus left, AddressValidationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AddressValidationStatus(string value) => new AddressValidationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddressValidationStatus other && Equals(other); + /// + public bool Equals(AddressValidationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AutoProvisioningStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AutoProvisioningStatus.cs new file mode 100644 index 000000000000..7a131fc16e70 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AutoProvisioningStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Auto Provisioning Details. + public readonly partial struct AutoProvisioningStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AutoProvisioningStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Provisioning Enabled. Will act as pre-approved, and arc extension will be enabled as soon as the device is verified to be at the right edge location. + public static AutoProvisioningStatus Enabled { get; } = new AutoProvisioningStatus(EnabledValue); + /// Provisioning Disabled. + public static AutoProvisioningStatus Disabled { get; } = new AutoProvisioningStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(AutoProvisioningStatus left, AutoProvisioningStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AutoProvisioningStatus left, AutoProvisioningStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AutoProvisioningStatus(string value) => new AutoProvisioningStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutoProvisioningStatus other && Equals(other); + /// + public bool Equals(AutoProvisioningStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.Serialization.cs similarity index 65% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.Serialization.cs index 3ece1f09fb4b..2bdf838c616f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductAvailabilityInformation : IUtf8JsonSerializable, IJsonModel + public partial class AvailabilityInformation : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductAvailabilityInformation)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AvailabilityInformation)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(AvailabilityStage)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductAvailabilityInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AvailabilityInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductAvailabilityInformation)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AvailabilityInformation)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductAvailabilityInformation(document.RootElement, options); + return DeserializeAvailabilityInformation(document.RootElement, options); } - internal static ProductAvailabilityInformation DeserializeProductAvailabilityInformation(JsonElement element, ModelReaderWriterOptions options = null) + internal static AvailabilityInformation DeserializeAvailabilityInformation(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,8 +86,8 @@ internal static ProductAvailabilityInformation DeserializeProductAvailabilityInf { return null; } - ProductAvailabilityStage? availabilityStage = default; - ProductDisabledReason? disabledReason = default; + AvailabilityStage? availabilityStage = default; + DisabledReason? disabledReason = default; string disabledReasonMessage = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -99,7 +99,7 @@ internal static ProductAvailabilityInformation DeserializeProductAvailabilityInf { continue; } - availabilityStage = new ProductAvailabilityStage(property.Value.GetString()); + availabilityStage = new AvailabilityStage(property.Value.GetString()); continue; } if (property.NameEquals("disabledReason"u8)) @@ -108,7 +108,7 @@ internal static ProductAvailabilityInformation DeserializeProductAvailabilityInf { continue; } - disabledReason = new ProductDisabledReason(property.Value.GetString()); + disabledReason = new DisabledReason(property.Value.GetString()); continue; } if (property.NameEquals("disabledReasonMessage"u8)) @@ -122,38 +122,38 @@ internal static ProductAvailabilityInformation DeserializeProductAvailabilityInf } } serializedAdditionalRawData = rawDataDictionary; - return new ProductAvailabilityInformation(availabilityStage, disabledReason, disabledReasonMessage, serializedAdditionalRawData); + return new AvailabilityInformation(availabilityStage, disabledReason, disabledReasonMessage, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductAvailabilityInformation)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AvailabilityInformation)} does not support writing '{options.Format}' format."); } } - ProductAvailabilityInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AvailabilityInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductAvailabilityInformation(document.RootElement, options); + return DeserializeAvailabilityInformation(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductAvailabilityInformation)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AvailabilityInformation)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.cs similarity index 77% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.cs index a42ead0b69a2..b910bcfac305 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityInformation.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityInformation.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Availability information of a product system. - public partial class ProductAvailabilityInformation + public partial class AvailabilityInformation { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class ProductAvailabilityInformation /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductAvailabilityInformation() + /// Initializes a new instance of . + internal AvailabilityInformation() { } - /// Initializes a new instance of . - /// Current availability stage of the product. Availability stage. + /// Initializes a new instance of . + /// Current availability stage of the product. /// Reason why the product is disabled. /// Message for why the product is disabled. /// Keeps track of any properties unknown to the library. - internal ProductAvailabilityInformation(ProductAvailabilityStage? availabilityStage, ProductDisabledReason? disabledReason, string disabledReasonMessage, IDictionary serializedAdditionalRawData) + internal AvailabilityInformation(AvailabilityStage? availabilityStage, DisabledReason? disabledReason, string disabledReasonMessage, IDictionary serializedAdditionalRawData) { AvailabilityStage = availabilityStage; DisabledReason = disabledReason; @@ -63,10 +63,10 @@ internal ProductAvailabilityInformation(ProductAvailabilityStage? availabilitySt _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Current availability stage of the product. Availability stage. - public ProductAvailabilityStage? AvailabilityStage { get; } + /// Current availability stage of the product. + public AvailabilityStage? AvailabilityStage { get; } /// Reason why the product is disabled. - public ProductDisabledReason? DisabledReason { get; } + public DisabledReason? DisabledReason { get; } /// Message for why the product is disabled. public string DisabledReasonMessage { get; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityStage.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityStage.cs new file mode 100644 index 000000000000..fc360206c76d --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/AvailabilityStage.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Current availability stage of the product. + public readonly partial struct AvailabilityStage : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AvailabilityStage(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvailableValue = "Available"; + private const string PreviewValue = "Preview"; + private const string SignupValue = "Signup"; + private const string DiscoverableValue = "Discoverable"; + private const string ComingSoonValue = "ComingSoon"; + private const string UnavailableValue = "Unavailable"; + private const string DeprecatedValue = "Deprecated"; + + /// Product is available. + public static AvailabilityStage Available { get; } = new AvailabilityStage(AvailableValue); + /// Product is in preview. + public static AvailabilityStage Preview { get; } = new AvailabilityStage(PreviewValue); + /// Product is available only on signup. + public static AvailabilityStage Signup { get; } = new AvailabilityStage(SignupValue); + /// Product is not available in our service but can be discovered from other sources. + public static AvailabilityStage Discoverable { get; } = new AvailabilityStage(DiscoverableValue); + /// Product is coming soon. + public static AvailabilityStage ComingSoon { get; } = new AvailabilityStage(ComingSoonValue); + /// Product is not available. + public static AvailabilityStage Unavailable { get; } = new AvailabilityStage(UnavailableValue); + /// Product is deprecated. + public static AvailabilityStage Deprecated { get; } = new AvailabilityStage(DeprecatedValue); + /// Determines if two values are the same. + public static bool operator ==(AvailabilityStage left, AvailabilityStage right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AvailabilityStage left, AvailabilityStage right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AvailabilityStage(string value) => new AvailabilityStage(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvailabilityStage other && Equals(other); + /// + public bool Equals(AvailabilityStage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.Serialization.cs similarity index 63% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.Serialization.cs index 5afcde946c8a..b2e621b9601b 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderProductBillingMeterDetails : IUtf8JsonSerializable, IJsonModel + public partial class BillingMeterDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductBillingMeterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(BillingMeterDetails)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Name)) @@ -54,6 +54,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("frequency"u8); writer.WriteStringValue(Frequency); } + if (options.Format != "W" && Optional.IsDefined(TermTypeDetails)) + { + writer.WritePropertyName("termTypeDetails"u8); + writer.WriteObjectValue(TermTypeDetails, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -71,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderProductBillingMeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + BillingMeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductBillingMeterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(BillingMeterDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductBillingMeterDetails(document.RootElement, options); + return DeserializeBillingMeterDetails(document.RootElement, options); } - internal static EdgeOrderProductBillingMeterDetails DeserializeEdgeOrderProductBillingMeterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static BillingMeterDetails DeserializeBillingMeterDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,9 +97,10 @@ internal static EdgeOrderProductBillingMeterDetails DeserializeEdgeOrderProductB return null; } string name = default; - EdgeOrderProductMeterDetails meterDetails = default; - EdgeOrderProductMeteringType? meteringType = default; + MeterDetails meterDetails = default; + MeteringType? meteringType = default; string frequency = default; + TermTypeDetails termTypeDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -110,7 +116,7 @@ internal static EdgeOrderProductBillingMeterDetails DeserializeEdgeOrderProductB { continue; } - meterDetails = EdgeOrderProductMeterDetails.DeserializeEdgeOrderProductMeterDetails(property.Value, options); + meterDetails = MeterDetails.DeserializeMeterDetails(property.Value, options); continue; } if (property.NameEquals("meteringType"u8)) @@ -119,7 +125,7 @@ internal static EdgeOrderProductBillingMeterDetails DeserializeEdgeOrderProductB { continue; } - meteringType = new EdgeOrderProductMeteringType(property.Value.GetString()); + meteringType = new MeteringType(property.Value.GetString()); continue; } if (property.NameEquals("frequency"u8)) @@ -127,44 +133,59 @@ internal static EdgeOrderProductBillingMeterDetails DeserializeEdgeOrderProductB frequency = property.Value.GetString(); continue; } + if (property.NameEquals("termTypeDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termTypeDetails = TermTypeDetails.DeserializeTermTypeDetails(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderProductBillingMeterDetails(name, meterDetails, meteringType, frequency, serializedAdditionalRawData); + return new BillingMeterDetails( + name, + meterDetails, + meteringType, + frequency, + termTypeDetails, + serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductBillingMeterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingMeterDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductBillingMeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + BillingMeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductBillingMeterDetails(document.RootElement, options); + return DeserializeBillingMeterDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductBillingMeterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingMeterDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.cs similarity index 67% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.cs index 07fcb56663f3..585c888b0e5c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductBillingMeterDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/BillingMeterDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Holds billing meter details for each type of billing. - public partial class EdgeOrderProductBillingMeterDetails + public partial class BillingMeterDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,41 +45,45 @@ public partial class EdgeOrderProductBillingMeterDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal EdgeOrderProductBillingMeterDetails() + /// Initializes a new instance of . + internal BillingMeterDetails() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Represents Billing type name. /// - /// Represents MeterDetails - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Represents MeterDetails. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// Represents Metering type (eg one-time or recurrent). /// Frequency of recurrence. + /// Represent Term Type details. /// Keeps track of any properties unknown to the library. - internal EdgeOrderProductBillingMeterDetails(string name, EdgeOrderProductMeterDetails meterDetails, EdgeOrderProductMeteringType? meteringType, string frequency, IDictionary serializedAdditionalRawData) + internal BillingMeterDetails(string name, MeterDetails meterDetails, MeteringType? meteringType, string frequency, TermTypeDetails termTypeDetails, IDictionary serializedAdditionalRawData) { Name = name; MeterDetails = meterDetails; MeteringType = meteringType; Frequency = frequency; + TermTypeDetails = termTypeDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents Billing type name. public string Name { get; } /// - /// Represents MeterDetails - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Represents MeterDetails. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - public EdgeOrderProductMeterDetails MeterDetails { get; } + public MeterDetails MeterDetails { get; } /// Represents Metering type (eg one-time or recurrent). - public EdgeOrderProductMeteringType? MeteringType { get; } + public MeteringType? MeteringType { get; } /// Frequency of recurrence. public string Frequency { get; } + /// Represent Term Type details. + public TermTypeDetails TermTypeDetails { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.Serialization.cs similarity index 62% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.Serialization.cs index 2a4c5c3a84a8..9c0eba5d3892 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemCancellationReason : IUtf8JsonSerializable, IJsonModel + public partial class CancellationReason : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemCancellationReason)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CancellationReason)} does not support writing '{format}' format."); } writer.WritePropertyName("reason"u8); @@ -53,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemCancellationReason IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + CancellationReason IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemCancellationReason)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CancellationReason)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemCancellationReason(document.RootElement, options); + return DeserializeCancellationReason(document.RootElement, options); } - internal static EdgeOrderItemCancellationReason DeserializeEdgeOrderItemCancellationReason(JsonElement element, ModelReaderWriterOptions options = null) + internal static CancellationReason DeserializeCancellationReason(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -89,38 +89,38 @@ internal static EdgeOrderItemCancellationReason DeserializeEdgeOrderItemCancella } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemCancellationReason(reason, serializedAdditionalRawData); + return new CancellationReason(reason, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemCancellationReason)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CancellationReason)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemCancellationReason IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + CancellationReason IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemCancellationReason(document.RootElement, options); + return DeserializeCancellationReason(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemCancellationReason)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CancellationReason)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.cs similarity index 78% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.cs index 7c3abb6e1bbf..e14fc744c370 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemCancellationReason.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CancellationReason.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Reason for cancellation. - public partial class EdgeOrderItemCancellationReason + public partial class CancellationReason { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,27 @@ public partial class EdgeOrderItemCancellationReason /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Reason for cancellation. /// is null. - public EdgeOrderItemCancellationReason(string reason) + public CancellationReason(string reason) { Argument.AssertNotNull(reason, nameof(reason)); Reason = reason; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Reason for cancellation. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemCancellationReason(string reason, IDictionary serializedAdditionalRawData) + internal CancellationReason(string reason, IDictionary serializedAdditionalRawData) { Reason = reason; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemCancellationReason() + /// Initializes a new instance of for deserialization. + internal CancellationReason() { } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.Serialization.cs new file mode 100644 index 000000000000..5d46d2fc769f --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class CategoryInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CategoryInformation)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CategoryName)) + { + writer.WritePropertyName("categoryName"u8); + writer.WriteStringValue(CategoryName); + } + if (Optional.IsDefined(CategoryDisplayName)) + { + writer.WritePropertyName("categoryDisplayName"u8); + writer.WriteStringValue(CategoryDisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CategoryInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CategoryInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCategoryInformation(document.RootElement, options); + } + + internal static CategoryInformation DeserializeCategoryInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string categoryName = default; + string categoryDisplayName = default; + string description = default; + IReadOnlyList links = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("categoryName"u8)) + { + categoryName = property.Value.GetString(); + continue; + } + if (property.NameEquals("categoryDisplayName"u8)) + { + categoryDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("links"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Link.DeserializeLink(item, options)); + } + links = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CategoryInformation(categoryName, categoryDisplayName, description, links ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(CategoryInformation)} does not support writing '{options.Format}' format."); + } + } + + CategoryInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCategoryInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CategoryInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.cs new file mode 100644 index 000000000000..26b8f61860d1 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CategoryInformation.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Category related properties of a child configuration. + public partial class CategoryInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CategoryInformation() + { + Links = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Category name of the child configuration. + /// Category display name of the child configuration. + /// Description text for the category. + /// Links for the category. + /// Keeps track of any properties unknown to the library. + internal CategoryInformation(string categoryName, string categoryDisplayName, string description, IReadOnlyList links, IDictionary serializedAdditionalRawData) + { + CategoryName = categoryName; + CategoryDisplayName = categoryDisplayName; + Description = description; + Links = links; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Category name of the child configuration. + public string CategoryName { get; } + /// Category display name of the child configuration. + public string CategoryDisplayName { get; } + /// Description text for the category. + public string Description { get; } + /// Links for the category. + public IReadOnlyList Links { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChargingType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChargingType.cs new file mode 100644 index 000000000000..99bbdbd79804 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChargingType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Charging type. + public readonly partial struct ChargingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ChargingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PerOrderValue = "PerOrder"; + private const string PerDeviceValue = "PerDevice"; + + /// Per order charging type. + public static ChargingType PerOrder { get; } = new ChargingType(PerOrderValue); + /// Per device charging type. + public static ChargingType PerDevice { get; } = new ChargingType(PerDeviceValue); + /// Determines if two values are the same. + public static bool operator ==(ChargingType left, ChargingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ChargingType left, ChargingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ChargingType(string value) => new ChargingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ChargingType other && Equals(other); + /// + public bool Equals(ChargingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.Serialization.cs new file mode 100644 index 000000000000..74e79de6fcc7 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.Serialization.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class ChildConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChildConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ChildConfigurationType)) + { + writer.WritePropertyName("childConfigurationType"u8); + writer.WriteStringValue(ChildConfigurationType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(IsPartOfBaseConfiguration)) + { + writer.WritePropertyName("isPartOfBaseConfiguration"u8); + writer.WriteBooleanValue(IsPartOfBaseConfiguration.Value); + } + if (options.Format != "W" && Optional.IsDefined(MinimumQuantity)) + { + writer.WritePropertyName("minimumQuantity"u8); + writer.WriteNumberValue(MinimumQuantity.Value); + } + if (options.Format != "W" && Optional.IsDefined(MaximumQuantity)) + { + writer.WritePropertyName("maximumQuantity"u8); + writer.WriteNumberValue(MaximumQuantity.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Specifications)) + { + writer.WritePropertyName("specifications"u8); + writer.WriteStartArray(); + foreach (var item in Specifications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"u8); + writer.WriteObjectValue(Dimensions, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningSupport)) + { + writer.WritePropertyName("provisioningSupport"u8); + writer.WriteStringValue(ProvisioningSupport.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ChildConfigurationTypes)) + { + writer.WritePropertyName("childConfigurationTypes"u8); + writer.WriteStartArray(); + foreach (var item in ChildConfigurationTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(GroupedChildConfigurations)) + { + writer.WritePropertyName("groupedChildConfigurations"u8); + writer.WriteStartArray(); + foreach (var item in GroupedChildConfigurations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(SupportedTermCommitmentDurations)) + { + writer.WritePropertyName("supportedTermCommitmentDurations"u8); + writer.WriteStartArray(); + foreach (var item in SupportedTermCommitmentDurations) + { + writer.WriteStringValue(item, "P"); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) + { + writer.WritePropertyName("filterableProperties"u8); + writer.WriteStartArray(); + foreach (var item in FilterableProperties) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteObjectValue(Description, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) + { + writer.WritePropertyName("imageInformation"u8); + writer.WriteStartArray(); + foreach (var item in ImageInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CostInformation)) + { + writer.WritePropertyName("costInformation"u8); + writer.WriteObjectValue(CostInformation, options); + } + if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) + { + writer.WritePropertyName("availabilityInformation"u8); + writer.WriteObjectValue(AvailabilityInformation, options); + } + if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) + { + writer.WritePropertyName("hierarchyInformation"u8); + writer.WriteObjectValue(HierarchyInformation, options); + } + if (options.Format != "W" && Optional.IsDefined(FulfilledBy)) + { + writer.WritePropertyName("fulfilledBy"u8); + writer.WriteStringValue(FulfilledBy.Value.ToString()); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ChildConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChildConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChildConfiguration(document.RootElement, options); + } + + internal static ChildConfiguration DeserializeChildConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChildConfigurationType? childConfigurationType = default; + bool? isPartOfBaseConfiguration = default; + int? minimumQuantity = default; + int? maximumQuantity = default; + IReadOnlyList specifications = default; + Dimensions dimensions = default; + ProvisioningSupport? provisioningSupport = default; + IReadOnlyList childConfigurationTypes = default; + IReadOnlyList groupedChildConfigurations = default; + IReadOnlyList supportedTermCommitmentDurations = default; + IReadOnlyList filterableProperties = default; + string displayName = default; + Description description = default; + IReadOnlyList imageInformation = default; + CostInformation costInformation = default; + AvailabilityInformation availabilityInformation = default; + HierarchyInformation hierarchyInformation = default; + FulfillmentType? fulfilledBy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("childConfigurationType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + childConfigurationType = new ChildConfigurationType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("isPartOfBaseConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isPartOfBaseConfiguration = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("minimumQuantity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumQuantity = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("maximumQuantity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumQuantity = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("specifications"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Specification.DeserializeSpecification(item, options)); + } + specifications = array; + continue; + } + if (property0.NameEquals("dimensions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dimensions = Dimensions.DeserializeDimensions(property0.Value, options); + continue; + } + if (property0.NameEquals("provisioningSupport"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningSupport = new ProvisioningSupport(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("childConfigurationTypes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ChildConfigurationType(item.GetString())); + } + childConfigurationTypes = array; + continue; + } + if (property0.NameEquals("groupedChildConfigurations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.GroupedChildConfigurations.DeserializeGroupedChildConfigurations(item, options)); + } + groupedChildConfigurations = array; + continue; + } + if (property0.NameEquals("supportedTermCommitmentDurations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetTimeSpan("P")); + } + supportedTermCommitmentDurations = array; + continue; + } + if (property0.NameEquals("filterableProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); + } + filterableProperties = array; + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + description = Description.DeserializeDescription(property0.Value, options); + continue; + } + if (property0.NameEquals("imageInformation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.ImageInformation.DeserializeImageInformation(item, options)); + } + imageInformation = array; + continue; + } + if (property0.NameEquals("costInformation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + costInformation = CostInformation.DeserializeCostInformation(property0.Value, options); + continue; + } + if (property0.NameEquals("availabilityInformation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilityInformation = AvailabilityInformation.DeserializeAvailabilityInformation(property0.Value, options); + continue; + } + if (property0.NameEquals("hierarchyInformation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); + continue; + } + if (property0.NameEquals("fulfilledBy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fulfilledBy = new FulfillmentType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ChildConfiguration( + childConfigurationType, + isPartOfBaseConfiguration, + minimumQuantity, + maximumQuantity, + specifications ?? new ChangeTrackingList(), + dimensions, + provisioningSupport, + childConfigurationTypes ?? new ChangeTrackingList(), + groupedChildConfigurations ?? new ChangeTrackingList(), + supportedTermCommitmentDurations ?? new ChangeTrackingList(), + filterableProperties ?? new ChangeTrackingList(), + displayName, + description, + imageInformation ?? new ChangeTrackingList(), + costInformation, + availabilityInformation, + hierarchyInformation, + fulfilledBy, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ChildConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ChildConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeChildConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChildConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.cs new file mode 100644 index 000000000000..3c3b831b2b1e --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfiguration.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Child configuration object. + public partial class ChildConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ChildConfiguration() + { + Specifications = new ChangeTrackingList(); + ChildConfigurationTypes = new ChangeTrackingList(); + GroupedChildConfigurations = new ChangeTrackingList(); + SupportedTermCommitmentDurations = new ChangeTrackingList(); + FilterableProperties = new ChangeTrackingList(); + ImageInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Child configuration type. + /// Flag to indicate if the child configuration is part of the base configuration, which means the customer need not pass this configuration in OptInAdditionalConfigurations while placing an order, it will be shipped by default. + /// Minimum quantity a customer can order while choosing this configuration. + /// Maximum quantity a customer can order while choosing this configuration. + /// Specifications of the configuration. + /// Dimensions of the configuration. + /// Determining nature of provisioning that the configuration supports. + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + /// The Term Commitment Durations that are supported for a configuration. + /// List of filters supported for a product. + /// Display Name for the product system. + /// Description related to the product system. + /// Image information for the product system. + /// Cost information for the product system. + /// Availability information of the product system. + /// Hierarchy information of a product. + /// The entity responsible for fulfillment of the item at the given hierarchy level. + /// Keeps track of any properties unknown to the library. + internal ChildConfiguration(ChildConfigurationType? childConfigurationType, bool? isPartOfBaseConfiguration, int? minimumQuantity, int? maximumQuantity, IReadOnlyList specifications, Dimensions dimensions, ProvisioningSupport? provisioningSupport, IReadOnlyList childConfigurationTypes, IReadOnlyList groupedChildConfigurations, IReadOnlyList supportedTermCommitmentDurations, IReadOnlyList filterableProperties, string displayName, Description description, IReadOnlyList imageInformation, CostInformation costInformation, AvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, FulfillmentType? fulfilledBy, IDictionary serializedAdditionalRawData) + { + ChildConfigurationType = childConfigurationType; + IsPartOfBaseConfiguration = isPartOfBaseConfiguration; + MinimumQuantity = minimumQuantity; + MaximumQuantity = maximumQuantity; + Specifications = specifications; + Dimensions = dimensions; + ProvisioningSupport = provisioningSupport; + ChildConfigurationTypes = childConfigurationTypes; + GroupedChildConfigurations = groupedChildConfigurations; + SupportedTermCommitmentDurations = supportedTermCommitmentDurations; + FilterableProperties = filterableProperties; + DisplayName = displayName; + Description = description; + ImageInformation = imageInformation; + CostInformation = costInformation; + AvailabilityInformation = availabilityInformation; + HierarchyInformation = hierarchyInformation; + FulfilledBy = fulfilledBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Child configuration type. + public ChildConfigurationType? ChildConfigurationType { get; } + /// Flag to indicate if the child configuration is part of the base configuration, which means the customer need not pass this configuration in OptInAdditionalConfigurations while placing an order, it will be shipped by default. + public bool? IsPartOfBaseConfiguration { get; } + /// Minimum quantity a customer can order while choosing this configuration. + public int? MinimumQuantity { get; } + /// Maximum quantity a customer can order while choosing this configuration. + public int? MaximumQuantity { get; } + /// Specifications of the configuration. + public IReadOnlyList Specifications { get; } + /// Dimensions of the configuration. + public Dimensions Dimensions { get; } + /// Determining nature of provisioning that the configuration supports. + public ProvisioningSupport? ProvisioningSupport { get; } + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + public IReadOnlyList ChildConfigurationTypes { get; } + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + public IReadOnlyList GroupedChildConfigurations { get; } + /// The Term Commitment Durations that are supported for a configuration. + public IReadOnlyList SupportedTermCommitmentDurations { get; } + /// List of filters supported for a product. + public IReadOnlyList FilterableProperties { get; } + /// Display Name for the product system. + public string DisplayName { get; } + /// Description related to the product system. + public Description Description { get; } + /// Image information for the product system. + public IReadOnlyList ImageInformation { get; } + /// Cost information for the product system. + public CostInformation CostInformation { get; } + /// Availability information of the product system. + public AvailabilityInformation AvailabilityInformation { get; } + /// Hierarchy information of a product. + public HierarchyInformation HierarchyInformation { get; } + /// The entity responsible for fulfillment of the item at the given hierarchy level. + public FulfillmentType? FulfilledBy { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.Serialization.cs new file mode 100644 index 000000000000..3cbcd716fd46 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class ChildConfigurationFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChildConfigurationFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(HierarchyInformations)) + { + writer.WritePropertyName("hierarchyInformations"u8); + writer.WriteStartArray(); + foreach (var item in HierarchyInformations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ChildConfigurationTypes)) + { + writer.WritePropertyName("childConfigurationTypes"u8); + writer.WriteStartArray(); + foreach (var item in ChildConfigurationTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ChildConfigurationFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChildConfigurationFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChildConfigurationFilter(document.RootElement, options); + } + + internal static ChildConfigurationFilter DeserializeChildConfigurationFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList hierarchyInformations = default; + IList childConfigurationTypes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hierarchyInformations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HierarchyInformation.DeserializeHierarchyInformation(item, options)); + } + hierarchyInformations = array; + continue; + } + if (property.NameEquals("childConfigurationTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ChildConfigurationType(item.GetString())); + } + childConfigurationTypes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ChildConfigurationFilter(hierarchyInformations ?? new ChangeTrackingList(), childConfigurationTypes ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ChildConfigurationFilter)} does not support writing '{options.Format}' format."); + } + } + + ChildConfigurationFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeChildConfigurationFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChildConfigurationFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.cs new file mode 100644 index 000000000000..48d7ae264388 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationFilter.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Child configuration filter. + public partial class ChildConfigurationFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ChildConfigurationFilter() + { + HierarchyInformations = new ChangeTrackingList(); + ChildConfigurationTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of child configuration hierarchy customer wants to filter for the given configuration. + /// Filter to fetch all child configurations belonging to the given list of configuration types. + /// Keeps track of any properties unknown to the library. + internal ChildConfigurationFilter(IList hierarchyInformations, IList childConfigurationTypes, IDictionary serializedAdditionalRawData) + { + HierarchyInformations = hierarchyInformations; + ChildConfigurationTypes = childConfigurationTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of child configuration hierarchy customer wants to filter for the given configuration. + public IList HierarchyInformations { get; } + /// Filter to fetch all child configurations belonging to the given list of configuration types. + public IList ChildConfigurationTypes { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationType.cs new file mode 100644 index 000000000000..ed4a544d5d82 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ChildConfigurationType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// The ChildConfigurationType. + public readonly partial struct ChildConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ChildConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DeviceConfigurationValue = "DeviceConfiguration"; + private const string AdditionalConfigurationValue = "AdditionalConfiguration"; + + /// Child configuration is a device configuration. + public static ChildConfigurationType DeviceConfiguration { get; } = new ChildConfigurationType(DeviceConfigurationValue); + /// Child configuration is an additional configuration. + public static ChildConfigurationType AdditionalConfiguration { get; } = new ChildConfigurationType(AdditionalConfigurationValue); + /// Determines if two values are the same. + public static bool operator ==(ChildConfigurationType left, ChildConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ChildConfigurationType left, ChildConfigurationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ChildConfigurationType(string value) => new ChildConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ChildConfigurationType other && Equals(other); + /// + public bool Equals(ChildConfigurationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.Serialization.cs similarity index 51% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.Serialization.cs index 052723020689..9757c245cbf6 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductConfiguration : IUtf8JsonSerializable, IJsonModel + public partial class Configuration : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,73 +28,63 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductConfiguration)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Configuration)} does not support writing '{format}' format."); } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteObjectValue(Description, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) + if (options.Format != "W" && Optional.IsCollectionDefined(Specifications)) { - writer.WritePropertyName("imageInformation"u8); + writer.WritePropertyName("specifications"u8); writer.WriteStartArray(); - foreach (var item in ImageInformation) + foreach (var item in Specifications) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(CostInformation)) - { - writer.WritePropertyName("costInformation"u8); - writer.WriteObjectValue(CostInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) + if (options.Format != "W" && Optional.IsDefined(Dimensions)) { - writer.WritePropertyName("availabilityInformation"u8); - writer.WriteObjectValue(AvailabilityInformation, options); + writer.WritePropertyName("dimensions"u8); + writer.WriteObjectValue(Dimensions, options); } - if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningSupport)) { - writer.WritePropertyName("hierarchyInformation"u8); - writer.WriteObjectValue(HierarchyInformation, options); + writer.WritePropertyName("provisioningSupport"u8); + writer.WriteStringValue(ProvisioningSupport.Value.ToString()); } - if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) + if (options.Format != "W" && Optional.IsCollectionDefined(ChildConfigurationTypes)) { - writer.WritePropertyName("filterableProperties"u8); + writer.WritePropertyName("childConfigurationTypes"u8); writer.WriteStartArray(); - foreach (var item in FilterableProperties) + foreach (var item in ChildConfigurationTypes) { - writer.WriteObjectValue(item, options); + writer.WriteStringValue(item.ToString()); } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsCollectionDefined(Specifications)) + if (options.Format != "W" && Optional.IsCollectionDefined(GroupedChildConfigurations)) { - writer.WritePropertyName("specifications"u8); + writer.WritePropertyName("groupedChildConfigurations"u8); writer.WriteStartArray(); - foreach (var item in Specifications) + foreach (var item in GroupedChildConfigurations) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(Dimensions)) + if (options.Format != "W" && Optional.IsCollectionDefined(SupportedTermCommitmentDurations)) { - writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions, options); + writer.WritePropertyName("supportedTermCommitmentDurations"u8); + writer.WriteStartArray(); + foreach (var item in SupportedTermCommitmentDurations) + { + writer.WriteStringValue(item, "P"); + } + writer.WriteEndArray(); } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) @@ -114,19 +104,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Configuration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductConfiguration)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Configuration)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductConfiguration(document.RootElement, options); + return DeserializeConfiguration(document.RootElement, options); } - internal static ProductConfiguration DeserializeProductConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + internal static Configuration DeserializeConfiguration(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -134,15 +124,12 @@ internal static ProductConfiguration DeserializeProductConfiguration(JsonElement { return null; } - string displayName = default; - ProductDescription description = default; - IReadOnlyList imageInformation = default; - EdgeOrderProductCostInformation costInformation = default; - ProductAvailabilityInformation availabilityInformation = default; - HierarchyInformation hierarchyInformation = default; - IReadOnlyList filterableProperties = default; - IReadOnlyList specifications = default; - ProductDimensions dimensions = default; + IReadOnlyList specifications = default; + Dimensions dimensions = default; + ProvisioningSupport? provisioningSupport = default; + IReadOnlyList childConfigurationTypes = default; + IReadOnlyList groupedChildConfigurations = default; + IReadOnlyList supportedTermCommitmentDurations = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -156,96 +143,78 @@ internal static ProductConfiguration DeserializeProductConfiguration(JsonElement } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - description = ProductDescription.DeserializeProductDescription(property0.Value, options); - continue; - } - if (property0.NameEquals("imageInformation"u8)) + if (property0.NameEquals("specifications"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(EdgeOrderProductImageInformation.DeserializeEdgeOrderProductImageInformation(item, options)); - } - imageInformation = array; - continue; - } - if (property0.NameEquals("costInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; + array.Add(Specification.DeserializeSpecification(item, options)); } - costInformation = EdgeOrderProductCostInformation.DeserializeEdgeOrderProductCostInformation(property0.Value, options); + specifications = array; continue; } - if (property0.NameEquals("availabilityInformation"u8)) + if (property0.NameEquals("dimensions"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - availabilityInformation = ProductAvailabilityInformation.DeserializeProductAvailabilityInformation(property0.Value, options); + dimensions = Dimensions.DeserializeDimensions(property0.Value, options); continue; } - if (property0.NameEquals("hierarchyInformation"u8)) + if (property0.NameEquals("provisioningSupport"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); + provisioningSupport = new ProvisioningSupport(property0.Value.GetString()); continue; } - if (property0.NameEquals("filterableProperties"u8)) + if (property0.NameEquals("childConfigurationTypes"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); + array.Add(new ChildConfigurationType(item.GetString())); } - filterableProperties = array; + childConfigurationTypes = array; continue; } - if (property0.NameEquals("specifications"u8)) + if (property0.NameEquals("groupedChildConfigurations"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(ProductSpecification.DeserializeProductSpecification(item, options)); + array.Add(Models.GroupedChildConfigurations.DeserializeGroupedChildConfigurations(item, options)); } - specifications = array; + groupedChildConfigurations = array; continue; } - if (property0.NameEquals("dimensions"u8)) + if (property0.NameEquals("supportedTermCommitmentDurations"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - dimensions = ProductDimensions.DeserializeProductDimensions(property0.Value, options); + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetTimeSpan("P")); + } + supportedTermCommitmentDurations = array; continue; } } @@ -257,48 +226,45 @@ internal static ProductConfiguration DeserializeProductConfiguration(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new ProductConfiguration( - displayName, - description, - imageInformation ?? new ChangeTrackingList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties ?? new ChangeTrackingList(), - specifications ?? new ChangeTrackingList(), + return new Configuration( + specifications ?? new ChangeTrackingList(), dimensions, + provisioningSupport, + childConfigurationTypes ?? new ChangeTrackingList(), + groupedChildConfigurations ?? new ChangeTrackingList(), + supportedTermCommitmentDurations ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductConfiguration)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Configuration)} does not support writing '{options.Format}' format."); } } - ProductConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Configuration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductConfiguration(document.RootElement, options); + return DeserializeConfiguration(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductConfiguration)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Configuration)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.cs new file mode 100644 index 000000000000..d56970c9573f --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configuration.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Configuration object. + public partial class Configuration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal Configuration() + { + Specifications = new ChangeTrackingList(); + ChildConfigurationTypes = new ChangeTrackingList(); + GroupedChildConfigurations = new ChangeTrackingList(); + SupportedTermCommitmentDurations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Specifications of the configuration. + /// Dimensions of the configuration. + /// Determining nature of provisioning that the configuration supports. + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + /// The Term Commitment Durations that are supported for a configuration. + /// Keeps track of any properties unknown to the library. + internal Configuration(IReadOnlyList specifications, Dimensions dimensions, ProvisioningSupport? provisioningSupport, IReadOnlyList childConfigurationTypes, IReadOnlyList groupedChildConfigurations, IReadOnlyList supportedTermCommitmentDurations, IDictionary serializedAdditionalRawData) + { + Specifications = specifications; + Dimensions = dimensions; + ProvisioningSupport = provisioningSupport; + ChildConfigurationTypes = childConfigurationTypes; + GroupedChildConfigurations = groupedChildConfigurations; + SupportedTermCommitmentDurations = supportedTermCommitmentDurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Specifications of the configuration. + public IReadOnlyList Specifications { get; } + /// Dimensions of the configuration. + public Dimensions Dimensions { get; } + /// Determining nature of provisioning that the configuration supports. + public ProvisioningSupport? ProvisioningSupport { get; } + /// Different types of child configurations which exist for this configuration, these can be used to populate the child configuration filter. + public IReadOnlyList ChildConfigurationTypes { get; } + /// Child configurations present for the configuration after applying child configuration filter, grouped by the category name of the child configuration. + public IReadOnlyList GroupedChildConfigurations { get; } + /// The Term Commitment Durations that are supported for a configuration. + public IReadOnlyList SupportedTermCommitmentDurations { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.Serialization.cs new file mode 100644 index 000000000000..2db760b006ec --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class ConfigurationDeviceDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationDeviceDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayInfo)) + { + writer.WritePropertyName("displayInfo"u8); + writer.WriteObjectValue(DisplayInfo, options); + } + if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) + { + writer.WritePropertyName("hierarchyInformation"u8); + writer.WriteObjectValue(HierarchyInformation, options); + } + if (options.Format != "W" && Optional.IsDefined(Quantity)) + { + writer.WritePropertyName("quantity"u8); + writer.WriteNumberValue(Quantity.Value); + } + if (options.Format != "W" && Optional.IsDefined(IdentificationType)) + { + writer.WritePropertyName("identificationType"u8); + writer.WriteStringValue(IdentificationType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(DeviceDetails)) + { + writer.WritePropertyName("deviceDetails"u8); + writer.WriteStartArray(); + foreach (var item in DeviceDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(TermCommitmentInformation)) + { + writer.WritePropertyName("termCommitmentInformation"u8); + writer.WriteObjectValue(TermCommitmentInformation, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConfigurationDeviceDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationDeviceDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationDeviceDetails(document.RootElement, options); + } + + internal static ConfigurationDeviceDetails DeserializeConfigurationDeviceDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DisplayInfo displayInfo = default; + HierarchyInformation hierarchyInformation = default; + int? quantity = default; + IdentificationType? identificationType = default; + IReadOnlyList deviceDetails = default; + TermCommitmentInformation termCommitmentInformation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayInfo = DisplayInfo.DeserializeDisplayInfo(property.Value, options); + continue; + } + if (property.NameEquals("hierarchyInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property.Value, options); + continue; + } + if (property.NameEquals("quantity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quantity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("identificationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identificationType = new IdentificationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("deviceDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DeviceDetails.DeserializeDeviceDetails(item, options)); + } + deviceDetails = array; + continue; + } + if (property.NameEquals("termCommitmentInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termCommitmentInformation = TermCommitmentInformation.DeserializeTermCommitmentInformation(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationDeviceDetails( + displayInfo, + hierarchyInformation, + quantity, + identificationType, + deviceDetails ?? new ChangeTrackingList(), + termCommitmentInformation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ConfigurationDeviceDetails)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationDeviceDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConfigurationDeviceDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationDeviceDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.cs new file mode 100644 index 000000000000..8f30f480bde7 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationDeviceDetails.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Device details for configuration. + public partial class ConfigurationDeviceDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ConfigurationDeviceDetails() + { + DeviceDetails = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Display details of the product. + /// Hierarchy of the product which uniquely identifies the configuration. + /// Quantity of the product. + /// Identification type of the configuration. + /// List of device details. + /// Term Commitment Information of the Device. + /// Keeps track of any properties unknown to the library. + internal ConfigurationDeviceDetails(DisplayInfo displayInfo, HierarchyInformation hierarchyInformation, int? quantity, IdentificationType? identificationType, IReadOnlyList deviceDetails, TermCommitmentInformation termCommitmentInformation, IDictionary serializedAdditionalRawData) + { + DisplayInfo = displayInfo; + HierarchyInformation = hierarchyInformation; + Quantity = quantity; + IdentificationType = identificationType; + DeviceDetails = deviceDetails; + TermCommitmentInformation = termCommitmentInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Display details of the product. + public DisplayInfo DisplayInfo { get; } + /// Hierarchy of the product which uniquely identifies the configuration. + public HierarchyInformation HierarchyInformation { get; } + /// Quantity of the product. + public int? Quantity { get; } + /// Identification type of the configuration. + public IdentificationType? IdentificationType { get; } + /// List of device details. + public IReadOnlyList DeviceDetails { get; } + /// Term Commitment Information of the Device. + public TermCommitmentInformation TermCommitmentInformation { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.Serialization.cs similarity index 65% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.Serialization.cs index 6b8c99aa06dc..2564aedd7e73 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ConfigurationFilters : IUtf8JsonSerializable, IJsonModel + public partial class ConfigurationFilter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConfigurationFilters)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConfigurationFilter)} does not support writing '{format}' format."); } writer.WritePropertyName("hierarchyInformation"u8); @@ -46,6 +46,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(ChildConfigurationFilter)) + { + writer.WritePropertyName("childConfigurationFilter"u8); + writer.WriteObjectValue(ChildConfigurationFilter, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -63,19 +68,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConfigurationFilters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConfigurationFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConfigurationFilters)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConfigurationFilter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConfigurationFilters(document.RootElement, options); + return DeserializeConfigurationFilter(document.RootElement, options); } - internal static ConfigurationFilters DeserializeConfigurationFilters(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConfigurationFilter DeserializeConfigurationFilter(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -85,6 +90,7 @@ internal static ConfigurationFilters DeserializeConfigurationFilters(JsonElement } HierarchyInformation hierarchyInformation = default; IList filterableProperty = default; + ChildConfigurationFilter childConfigurationFilter = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -108,44 +114,53 @@ internal static ConfigurationFilters DeserializeConfigurationFilters(JsonElement filterableProperty = array; continue; } + if (property.NameEquals("childConfigurationFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + childConfigurationFilter = ChildConfigurationFilter.DeserializeChildConfigurationFilter(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ConfigurationFilters(hierarchyInformation, filterableProperty ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ConfigurationFilter(hierarchyInformation, filterableProperty ?? new ChangeTrackingList(), childConfigurationFilter, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ConfigurationFilters)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConfigurationFilter)} does not support writing '{options.Format}' format."); } } - ConfigurationFilters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConfigurationFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeConfigurationFilters(document.RootElement, options); + return DeserializeConfigurationFilter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ConfigurationFilters)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConfigurationFilter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.cs similarity index 71% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.cs index 2d22194d7407..b9090fcc3241 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilters.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationFilter.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Configuration filters. - public partial class ConfigurationFilters + public partial class ConfigurationFilter { /// /// Keeps track of any properties unknown to the library. @@ -45,10 +45,10 @@ public partial class ConfigurationFilters /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Product hierarchy information. /// is null. - public ConfigurationFilters(HierarchyInformation hierarchyInformation) + public ConfigurationFilter(HierarchyInformation hierarchyInformation) { Argument.AssertNotNull(hierarchyInformation, nameof(hierarchyInformation)); @@ -56,19 +56,21 @@ public ConfigurationFilters(HierarchyInformation hierarchyInformation) FilterableProperty = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Product hierarchy information. /// Filters specific to product. + /// Filter to fetch specific child configurations that exist in the configuration. This must be passed to either fetch a list of specific child configurations, or all child configurations of specific types of child configurations. /// Keeps track of any properties unknown to the library. - internal ConfigurationFilters(HierarchyInformation hierarchyInformation, IList filterableProperty, IDictionary serializedAdditionalRawData) + internal ConfigurationFilter(HierarchyInformation hierarchyInformation, IList filterableProperty, ChildConfigurationFilter childConfigurationFilter, IDictionary serializedAdditionalRawData) { HierarchyInformation = hierarchyInformation; FilterableProperty = filterableProperty; + ChildConfigurationFilter = childConfigurationFilter; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ConfigurationFilters() + /// Initializes a new instance of for deserialization. + internal ConfigurationFilter() { } @@ -76,5 +78,7 @@ internal ConfigurationFilters() public HierarchyInformation HierarchyInformation { get; } /// Filters specific to product. public IList FilterableProperty { get; } + /// Filter to fetch specific child configurations that exist in the configuration. This must be passed to either fetch a list of specific child configurations, or all child configurations of specific types of child configurations. + public ChildConfigurationFilter ChildConfigurationFilter { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.Serialization.cs similarity index 63% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.Serialization.cs index 724d60d8e737..740efe549f90 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - internal partial class ProductConfigurations : IUtf8JsonSerializable, IJsonModel + internal partial class Configurations : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,13 +28,13 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductConfigurations)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Configurations)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Configurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductConfigurations)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Configurations)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductConfigurations(document.RootElement, options); + return DeserializeConfigurations(document.RootElement, options); } - internal static ProductConfigurations DeserializeProductConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + internal static Configurations DeserializeConfigurations(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,29 +86,29 @@ internal static ProductConfigurations DeserializeProductConfigurations(JsonEleme { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ProductConfiguration.DeserializeProductConfiguration(item, options)); + array.Add(Configuration.DeserializeConfiguration(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,38 +117,38 @@ internal static ProductConfigurations DeserializeProductConfigurations(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new ProductConfigurations(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new Configurations(value, nextLink, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductConfigurations)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Configurations)} does not support writing '{options.Format}' format."); } } - ProductConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Configurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductConfigurations(document.RootElement, options); + return DeserializeConfigurations(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductConfigurations)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Configurations)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.cs similarity index 61% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.cs index 7b51dc436edb..c6610b2d6d73 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Configurations.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { - /// Holds details about product family metadata. - internal partial class ProductFamiliesMetadataListResult + /// The list of configurations. + internal partial class Configurations { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,32 @@ internal partial class ProductFamiliesMetadataListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductFamiliesMetadataListResult() + /// Initializes a new instance of . + /// The Configuration items on this page. + internal Configurations(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } - /// Initializes a new instance of . - /// List of product family metadata details. - /// Link for the next set of product families. + /// Initializes a new instance of . + /// The Configuration items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ProductFamiliesMetadataListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal Configurations(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of product family metadata details. - public IReadOnlyList Value { get; } - /// Link for the next set of product families. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal Configurations() + { + } + + /// The Configuration items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.Serialization.cs index 6ffbe15e8945..648726d5a61a 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.Serialization.cs @@ -34,13 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ConfigurationsContent)} does not support writing '{format}' format."); } - writer.WritePropertyName("configurationFilters"u8); - writer.WriteStartArray(); - foreach (var item in ConfigurationFilters) + if (Optional.IsDefined(ConfigurationFilter)) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName("configurationFilter"u8); + writer.WriteObjectValue(ConfigurationFilter, options); } - writer.WriteEndArray(); if (Optional.IsDefined(CustomerSubscriptionDetails)) { writer.WritePropertyName("customerSubscriptionDetails"u8); @@ -83,20 +81,19 @@ internal static ConfigurationsContent DeserializeConfigurationsContent(JsonEleme { return null; } - IList configurationFilters = default; + ConfigurationFilter configurationFilter = default; CustomerSubscriptionDetails customerSubscriptionDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("configurationFilters"u8)) + if (property.NameEquals("configurationFilter"u8)) { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + if (property.Value.ValueKind == JsonValueKind.Null) { - array.Add(Models.ConfigurationFilters.DeserializeConfigurationFilters(item, options)); + continue; } - configurationFilters = array; + configurationFilter = ConfigurationFilter.DeserializeConfigurationFilter(property.Value, options); continue; } if (property.NameEquals("customerSubscriptionDetails"u8)) @@ -114,7 +111,7 @@ internal static ConfigurationsContent DeserializeConfigurationsContent(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new ConfigurationsContent(configurationFilters, customerSubscriptionDetails, serializedAdditionalRawData); + return new ConfigurationsContent(configurationFilter, customerSubscriptionDetails, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.cs index e15a810b9ba9..02fd16a5ab6e 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ConfigurationsContent.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { @@ -47,33 +46,23 @@ public partial class ConfigurationsContent private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Holds details about product hierarchy information and filterable property. - /// is null. - public ConfigurationsContent(IEnumerable configurationFilters) + public ConfigurationsContent() { - Argument.AssertNotNull(configurationFilters, nameof(configurationFilters)); - - ConfigurationFilters = configurationFilters.ToList(); } /// Initializes a new instance of . - /// Holds details about product hierarchy information and filterable property. + /// Holds details about product hierarchy information and filterable property. /// Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing subscription details. /// Keeps track of any properties unknown to the library. - internal ConfigurationsContent(IList configurationFilters, CustomerSubscriptionDetails customerSubscriptionDetails, IDictionary serializedAdditionalRawData) + internal ConfigurationsContent(ConfigurationFilter configurationFilter, CustomerSubscriptionDetails customerSubscriptionDetails, IDictionary serializedAdditionalRawData) { - ConfigurationFilters = configurationFilters; + ConfigurationFilter = configurationFilter; CustomerSubscriptionDetails = customerSubscriptionDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ConfigurationsContent() - { - } - /// Holds details about product hierarchy information and filterable property. - public IList ConfigurationFilters { get; } + public ConfigurationFilter ConfigurationFilter { get; set; } /// Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing subscription details. public CustomerSubscriptionDetails CustomerSubscriptionDetails { get; set; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.Serialization.cs similarity index 66% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.Serialization.cs index fb8446073da6..90d93985420d 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderAddressContactDetails : IUtf8JsonSerializable, IJsonModel + public partial class ContactDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressContactDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ContactDetails)} does not support writing '{format}' format."); } - writer.WritePropertyName("contactName"u8); - writer.WriteStringValue(ContactName); - writer.WritePropertyName("phone"u8); - writer.WriteStringValue(Phone); + if (Optional.IsDefined(ContactName)) + { + writer.WritePropertyName("contactName"u8); + writer.WriteStringValue(ContactName); + } + if (Optional.IsDefined(Phone)) + { + writer.WritePropertyName("phone"u8); + writer.WriteStringValue(Phone); + } if (Optional.IsDefined(PhoneExtension)) { writer.WritePropertyName("phoneExtension"u8); @@ -48,13 +54,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("mobile"u8); writer.WriteStringValue(Mobile); } - writer.WritePropertyName("emailList"u8); - writer.WriteStartArray(); - foreach (var item in EmailList) + if (Optional.IsCollectionDefined(EmailList)) { - writer.WriteStringValue(item); + writer.WritePropertyName("emailList"u8); + writer.WriteStartArray(); + foreach (var item in EmailList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); } - writer.WriteEndArray(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -72,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderAddressContactDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ContactDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderAddressContactDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ContactDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderAddressContactDetails(document.RootElement, options); + return DeserializeContactDetails(document.RootElement, options); } - internal static EdgeOrderAddressContactDetails DeserializeEdgeOrderAddressContactDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static ContactDetails DeserializeContactDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -123,6 +132,10 @@ internal static EdgeOrderAddressContactDetails DeserializeEdgeOrderAddressContac } if (property.NameEquals("emailList"u8)) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -137,44 +150,44 @@ internal static EdgeOrderAddressContactDetails DeserializeEdgeOrderAddressContac } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderAddressContactDetails( + return new ContactDetails( contactName, phone, phoneExtension, mobile, - emailList, + emailList ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderAddressContactDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ContactDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderAddressContactDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ContactDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderAddressContactDetails(document.RootElement, options); + return DeserializeContactDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderAddressContactDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ContactDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.cs similarity index 66% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.cs index 7db45ce946cf..b50584ab9561 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressContactDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ContactDetails.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { /// Contact Details. - public partial class EdgeOrderAddressContactDetails + public partial class ContactDetails { /// /// Keeps track of any properties unknown to the library. @@ -46,30 +45,20 @@ public partial class EdgeOrderAddressContactDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Contact name of the person. - /// Phone number of the contact person. - /// List of Email-ids to be notified about job progress. - /// , or is null. - public EdgeOrderAddressContactDetails(string contactName, string phone, IEnumerable emailList) + /// Initializes a new instance of . + public ContactDetails() { - Argument.AssertNotNull(contactName, nameof(contactName)); - Argument.AssertNotNull(phone, nameof(phone)); - Argument.AssertNotNull(emailList, nameof(emailList)); - - ContactName = contactName; - Phone = phone; - EmailList = emailList.ToList(); + EmailList = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Contact name of the person. /// Phone number of the contact person. /// Phone extension number of the contact person. /// Mobile number of the contact person. /// List of Email-ids to be notified about job progress. /// Keeps track of any properties unknown to the library. - internal EdgeOrderAddressContactDetails(string contactName, string phone, string phoneExtension, string mobile, IList emailList, IDictionary serializedAdditionalRawData) + internal ContactDetails(string contactName, string phone, string phoneExtension, string mobile, IList emailList, IDictionary serializedAdditionalRawData) { ContactName = contactName; Phone = phone; @@ -79,11 +68,6 @@ internal EdgeOrderAddressContactDetails(string contactName, string phone, string _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderAddressContactDetails() - { - } - /// Contact name of the person. public string ContactName { get; set; } /// Phone number of the contact person. diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.Serialization.cs similarity index 60% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.Serialization.cs index 11830861972a..45f3949fff55 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderProductCostInformation : IUtf8JsonSerializable, IJsonModel + public partial class CostInformation : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductCostInformation)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CostInformation)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsCollectionDefined(BillingMeterDetails)) @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(BillingInfoUri)) { writer.WritePropertyName("billingInfoUrl"u8); - writer.WriteStringValue(BillingInfoUri.AbsoluteUri); + writer.WriteStringValue(BillingInfoUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderProductCostInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + CostInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductCostInformation)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CostInformation)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductCostInformation(document.RootElement, options); + return DeserializeCostInformation(document.RootElement, options); } - internal static EdgeOrderProductCostInformation DeserializeEdgeOrderProductCostInformation(JsonElement element, ModelReaderWriterOptions options = null) + internal static CostInformation DeserializeCostInformation(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,8 +86,8 @@ internal static EdgeOrderProductCostInformation DeserializeEdgeOrderProductCostI { return null; } - IReadOnlyList billingMeterDetails = default; - Uri billingInfoUrl = default; + IReadOnlyList billingMeterDetails = default; + string billingInfoUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -98,21 +98,17 @@ internal static EdgeOrderProductCostInformation DeserializeEdgeOrderProductCostI { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderProductBillingMeterDetails.DeserializeEdgeOrderProductBillingMeterDetails(item, options)); + array.Add(Models.BillingMeterDetails.DeserializeBillingMeterDetails(item, options)); } billingMeterDetails = array; continue; } if (property.NameEquals("billingInfoUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - billingInfoUrl = new Uri(property.Value.GetString()); + billingInfoUrl = property.Value.GetString(); continue; } if (options.Format != "W") @@ -121,38 +117,38 @@ internal static EdgeOrderProductCostInformation DeserializeEdgeOrderProductCostI } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderProductCostInformation(billingMeterDetails ?? new ChangeTrackingList(), billingInfoUrl, serializedAdditionalRawData); + return new CostInformation(billingMeterDetails ?? new ChangeTrackingList(), billingInfoUrl, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductCostInformation)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CostInformation)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductCostInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + CostInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductCostInformation(document.RootElement, options); + return DeserializeCostInformation(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductCostInformation)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CostInformation)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.cs similarity index 75% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.cs index 214d534e2e1b..d8a1558bbd49 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductCostInformation.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/CostInformation.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Cost information for the product system. - public partial class EdgeOrderProductCostInformation + public partial class CostInformation { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class EdgeOrderProductCostInformation /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal EdgeOrderProductCostInformation() + /// Initializes a new instance of . + internal CostInformation() { - BillingMeterDetails = new ChangeTrackingList(); + BillingMeterDetails = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Details on the various billing aspects for the product system. /// Default url to display billing information. /// Keeps track of any properties unknown to the library. - internal EdgeOrderProductCostInformation(IReadOnlyList billingMeterDetails, Uri billingInfoUri, IDictionary serializedAdditionalRawData) + internal CostInformation(IReadOnlyList billingMeterDetails, string billingInfoUri, IDictionary serializedAdditionalRawData) { BillingMeterDetails = billingMeterDetails; BillingInfoUri = billingInfoUri; @@ -63,8 +63,8 @@ internal EdgeOrderProductCostInformation(IReadOnlyList Details on the various billing aspects for the product system. - public IReadOnlyList BillingMeterDetails { get; } + public IReadOnlyList BillingMeterDetails { get; } /// Default url to display billing information. - public Uri BillingInfoUri { get; } + public string BillingInfoUri { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.Serialization.cs similarity index 77% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.Serialization.cs index ea80c95fef5b..6966e55b95f0 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductDescription : IUtf8JsonSerializable, IJsonModel + public partial class Description : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDescription)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Description)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(DescriptionType)) @@ -96,19 +96,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductDescription IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Description IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDescription)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Description)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductDescription(document.RootElement, options); + return DeserializeDescription(document.RootElement, options); } - internal static ProductDescription DeserializeProductDescription(JsonElement element, ModelReaderWriterOptions options = null) + internal static Description DeserializeDescription(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -116,12 +116,12 @@ internal static ProductDescription DeserializeProductDescription(JsonElement ele { return null; } - ProductDescriptionType? descriptionType = default; + DescriptionType? descriptionType = default; string shortDescription = default; string longDescription = default; IReadOnlyList keywords = default; IReadOnlyList attributes = default; - IReadOnlyList links = default; + IReadOnlyList links = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -132,7 +132,7 @@ internal static ProductDescription DeserializeProductDescription(JsonElement ele { continue; } - descriptionType = new ProductDescriptionType(property.Value.GetString()); + descriptionType = new DescriptionType(property.Value.GetString()); continue; } if (property.NameEquals("shortDescription"u8)) @@ -179,10 +179,10 @@ internal static ProductDescription DeserializeProductDescription(JsonElement ele { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ProductLink.DeserializeProductLink(item, options)); + array.Add(Link.DeserializeLink(item, options)); } links = array; continue; @@ -193,45 +193,45 @@ internal static ProductDescription DeserializeProductDescription(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ProductDescription( + return new Description( descriptionType, shortDescription, longDescription, keywords ?? new ChangeTrackingList(), attributes ?? new ChangeTrackingList(), - links ?? new ChangeTrackingList(), + links ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductDescription)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Description)} does not support writing '{options.Format}' format."); } } - ProductDescription IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Description IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductDescription(document.RootElement, options); + return DeserializeDescription(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductDescription)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Description)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.cs similarity index 82% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.cs index 4061dfd66862..5bd419992b77 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescription.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Description.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Description related properties of a product system. - public partial class ProductDescription + public partial class Description { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class ProductDescription /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductDescription() + /// Initializes a new instance of . + internal Description() { Keywords = new ChangeTrackingList(); Attributes = new ChangeTrackingList(); - Links = new ChangeTrackingList(); + Links = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Type of description. /// Short description of the product system. /// Long description of the product system. @@ -61,7 +61,7 @@ internal ProductDescription() /// Attributes for the product system. /// Links for the product system. /// Keeps track of any properties unknown to the library. - internal ProductDescription(ProductDescriptionType? descriptionType, string shortDescription, string longDescription, IReadOnlyList keywords, IReadOnlyList attributes, IReadOnlyList links, IDictionary serializedAdditionalRawData) + internal Description(DescriptionType? descriptionType, string shortDescription, string longDescription, IReadOnlyList keywords, IReadOnlyList attributes, IReadOnlyList links, IDictionary serializedAdditionalRawData) { DescriptionType = descriptionType; ShortDescription = shortDescription; @@ -73,7 +73,7 @@ internal ProductDescription(ProductDescriptionType? descriptionType, string shor } /// Type of description. - public ProductDescriptionType? DescriptionType { get; } + public DescriptionType? DescriptionType { get; } /// Short description of the product system. public string ShortDescription { get; } /// Long description of the product system. @@ -83,6 +83,6 @@ internal ProductDescription(ProductDescriptionType? descriptionType, string shor /// Attributes for the product system. public IReadOnlyList Attributes { get; } /// Links for the product system. - public IReadOnlyList Links { get; } + public IReadOnlyList Links { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DescriptionType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DescriptionType.cs new file mode 100644 index 000000000000..0b667304d7dd --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DescriptionType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Type of description. + public readonly partial struct DescriptionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DescriptionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BaseValue = "Base"; + + /// Base description. + public static DescriptionType Base { get; } = new DescriptionType(BaseValue); + /// Determines if two values are the same. + public static bool operator ==(DescriptionType left, DescriptionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DescriptionType left, DescriptionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DescriptionType(string value) => new DescriptionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DescriptionType other && Equals(other); + /// + public bool Equals(DescriptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.Serialization.cs similarity index 55% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.Serialization.cs index fc2ab6804caf..1195b533540c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderProductDeviceDetails : IUtf8JsonSerializable, IJsonModel + public partial class DeviceDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductDeviceDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeviceDetails)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(SerialNumber)) @@ -39,6 +39,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("serialNumber"u8); writer.WriteStringValue(SerialNumber); } + if (options.Format != "W" && Optional.IsDefined(DisplaySerialNumber)) + { + writer.WritePropertyName("displaySerialNumber"u8); + writer.WriteStringValue(DisplaySerialNumber); + } if (options.Format != "W" && Optional.IsDefined(ManagementResourceId)) { writer.WritePropertyName("managementResourceId"u8); @@ -49,6 +54,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("managementResourceTenantId"u8); writer.WriteStringValue(ManagementResourceTenantId); } + if (options.Format != "W" && Optional.IsDefined(ProvisioningSupport)) + { + writer.WritePropertyName("provisioningSupport"u8); + writer.WriteStringValue(ProvisioningSupport.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningDetails)) + { + writer.WritePropertyName("provisioningDetails"u8); + writer.WriteObjectValue(ProvisioningDetails, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -66,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderProductDeviceDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeviceDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductDeviceDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeviceDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductDeviceDetails(document.RootElement, options); + return DeserializeDeviceDetails(document.RootElement, options); } - internal static EdgeOrderProductDeviceDetails DeserializeEdgeOrderProductDeviceDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeviceDetails DeserializeDeviceDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,8 +102,11 @@ internal static EdgeOrderProductDeviceDetails DeserializeEdgeOrderProductDeviceD return null; } string serialNumber = default; + string displaySerialNumber = default; string managementResourceId = default; string managementResourceTenantId = default; + ProvisioningSupport? provisioningSupport = default; + ProvisioningDetails provisioningDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -98,6 +116,11 @@ internal static EdgeOrderProductDeviceDetails DeserializeEdgeOrderProductDeviceD serialNumber = property.Value.GetString(); continue; } + if (property.NameEquals("displaySerialNumber"u8)) + { + displaySerialNumber = property.Value.GetString(); + continue; + } if (property.NameEquals("managementResourceId"u8)) { managementResourceId = property.Value.GetString(); @@ -108,44 +131,69 @@ internal static EdgeOrderProductDeviceDetails DeserializeEdgeOrderProductDeviceD managementResourceTenantId = property.Value.GetString(); continue; } + if (property.NameEquals("provisioningSupport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningSupport = new ProvisioningSupport(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningDetails = ProvisioningDetails.DeserializeProvisioningDetails(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderProductDeviceDetails(serialNumber, managementResourceId, managementResourceTenantId, serializedAdditionalRawData); + return new DeviceDetails( + serialNumber, + displaySerialNumber, + managementResourceId, + managementResourceTenantId, + provisioningSupport, + provisioningDetails, + serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductDeviceDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductDeviceDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeviceDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductDeviceDetails(document.RootElement, options); + return DeserializeDeviceDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductDeviceDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeviceDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.cs similarity index 61% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.cs index c9697148c4e7..afe432a9e8c0 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductDeviceDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DeviceDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Device details. - public partial class EdgeOrderProductDeviceDetails + public partial class DeviceDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,29 +45,41 @@ public partial class EdgeOrderProductDeviceDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal EdgeOrderProductDeviceDetails() + /// Initializes a new instance of . + internal DeviceDetails() { } - /// Initializes a new instance of . - /// device serial number. + /// Initializes a new instance of . + /// Device serial number. + /// Device serial number to be displayed. /// Management Resource Id. /// Management Resource Tenant ID. + /// Determining nature of provisioning that the configuration supports. + /// Provisioning Details for the device. /// Keeps track of any properties unknown to the library. - internal EdgeOrderProductDeviceDetails(string serialNumber, string managementResourceId, string managementResourceTenantId, IDictionary serializedAdditionalRawData) + internal DeviceDetails(string serialNumber, string displaySerialNumber, string managementResourceId, string managementResourceTenantId, ProvisioningSupport? provisioningSupport, ProvisioningDetails provisioningDetails, IDictionary serializedAdditionalRawData) { SerialNumber = serialNumber; + DisplaySerialNumber = displaySerialNumber; ManagementResourceId = managementResourceId; ManagementResourceTenantId = managementResourceTenantId; + ProvisioningSupport = provisioningSupport; + ProvisioningDetails = provisioningDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// device serial number. + /// Device serial number. public string SerialNumber { get; } + /// Device serial number to be displayed. + public string DisplaySerialNumber { get; } /// Management Resource Id. public string ManagementResourceId { get; } /// Management Resource Tenant ID. public string ManagementResourceTenantId { get; } + /// Determining nature of provisioning that the configuration supports. + public ProvisioningSupport? ProvisioningSupport { get; } + /// Provisioning Details for the device. + public ProvisioningDetails ProvisioningDetails { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.Serialization.cs similarity index 57% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.Serialization.cs index 36cf8eabc793..2e99c9f024b8 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataListResult.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - internal partial class ProductFamiliesMetadataListResult : IUtf8JsonSerializable, IJsonModel + public partial class DevicePresenceVerificationDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,26 +28,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductFamiliesMetadataListResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DevicePresenceVerificationDetails)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (options.Format != "W" && Optional.IsDefined(Message)) { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductFamiliesMetadataListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DevicePresenceVerificationDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductFamiliesMetadataListResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DevicePresenceVerificationDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductFamiliesMetadataListResult(document.RootElement, options); + return DeserializeDevicePresenceVerificationDetails(document.RootElement, options); } - internal static ProductFamiliesMetadataListResult DeserializeProductFamiliesMetadataListResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static DevicePresenceVerificationDetails DeserializeDevicePresenceVerificationDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,29 +81,24 @@ internal static ProductFamiliesMetadataListResult DeserializeProductFamiliesMeta { return null; } - IReadOnlyList value = default; - string nextLink = default; + DevicePresenceVerificationStatus? status = default; + string message = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (property.NameEquals("status"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(item, options)); - } - value = array; + status = new DevicePresenceVerificationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("nextLink"u8)) + if (property.NameEquals("message"u8)) { - nextLink = property.Value.GetString(); + message = property.Value.GetString(); continue; } if (options.Format != "W") @@ -117,38 +107,38 @@ internal static ProductFamiliesMetadataListResult DeserializeProductFamiliesMeta } } serializedAdditionalRawData = rawDataDictionary; - return new ProductFamiliesMetadataListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new DevicePresenceVerificationDetails(status, message, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductFamiliesMetadataListResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DevicePresenceVerificationDetails)} does not support writing '{options.Format}' format."); } } - ProductFamiliesMetadataListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DevicePresenceVerificationDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductFamiliesMetadataListResult(document.RootElement, options); + return DeserializeDevicePresenceVerificationDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductFamiliesMetadataListResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DevicePresenceVerificationDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.cs new file mode 100644 index 000000000000..153fb37f5af7 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Proof of possession details. + public partial class DevicePresenceVerificationDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DevicePresenceVerificationDetails() + { + } + + /// Initializes a new instance of . + /// Proof of possession status. + /// Insights on current status. + /// Keeps track of any properties unknown to the library. + internal DevicePresenceVerificationDetails(DevicePresenceVerificationStatus? status, string message, IDictionary serializedAdditionalRawData) + { + Status = status; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Proof of possession status. + public DevicePresenceVerificationStatus? Status { get; } + /// Insights on current status. + public string Message { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationStatus.cs new file mode 100644 index 000000000000..ccf05c4062c4 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DevicePresenceVerificationStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Proof of possession status. + public readonly partial struct DevicePresenceVerificationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevicePresenceVerificationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotInitiatedValue = "NotInitiated"; + private const string CompletedValue = "Completed"; + + /// The device has not yet been verified to be with the right edge operator or at the right location. + public static DevicePresenceVerificationStatus NotInitiated { get; } = new DevicePresenceVerificationStatus(NotInitiatedValue); + /// Confirms that the device is verified to be with the right edge operator or at the right location. + public static DevicePresenceVerificationStatus Completed { get; } = new DevicePresenceVerificationStatus(CompletedValue); + /// Determines if two values are the same. + public static bool operator ==(DevicePresenceVerificationStatus left, DevicePresenceVerificationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevicePresenceVerificationStatus left, DevicePresenceVerificationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DevicePresenceVerificationStatus(string value) => new DevicePresenceVerificationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevicePresenceVerificationStatus other && Equals(other); + /// + public bool Equals(DevicePresenceVerificationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.Serialization.cs similarity index 77% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.Serialization.cs index 839306933e57..7a60875809b7 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductDimensions : IUtf8JsonSerializable, IJsonModel + public partial class Dimensions : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDimensions)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Dimensions)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Length)) @@ -86,19 +86,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductDimensions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Dimensions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDimensions)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Dimensions)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductDimensions(document.RootElement, options); + return DeserializeDimensions(document.RootElement, options); } - internal static ProductDimensions DeserializeProductDimensions(JsonElement element, ModelReaderWriterOptions options = null) + internal static Dimensions DeserializeDimensions(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -109,10 +109,10 @@ internal static ProductDimensions DeserializeProductDimensions(JsonElement eleme double? length = default; double? height = default; double? width = default; - ProductLengthHeightWidthUnit? lengthHeightUnit = default; + LengthHeightUnit? lengthHeightUnit = default; double? weight = default; double? depth = default; - ProductWeightMeasurementUnit? weightUnit = default; + WeightMeasurementUnit? weightUnit = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -150,7 +150,7 @@ internal static ProductDimensions DeserializeProductDimensions(JsonElement eleme { continue; } - lengthHeightUnit = new ProductLengthHeightWidthUnit(property.Value.GetString()); + lengthHeightUnit = new LengthHeightUnit(property.Value.GetString()); continue; } if (property.NameEquals("weight"u8)) @@ -177,7 +177,7 @@ internal static ProductDimensions DeserializeProductDimensions(JsonElement eleme { continue; } - weightUnit = new ProductWeightMeasurementUnit(property.Value.GetString()); + weightUnit = new WeightMeasurementUnit(property.Value.GetString()); continue; } if (options.Format != "W") @@ -186,7 +186,7 @@ internal static ProductDimensions DeserializeProductDimensions(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new ProductDimensions( + return new Dimensions( length, height, width, @@ -197,35 +197,35 @@ internal static ProductDimensions DeserializeProductDimensions(JsonElement eleme serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductDimensions)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Dimensions)} does not support writing '{options.Format}' format."); } } - ProductDimensions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Dimensions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductDimensions(document.RootElement, options); + return DeserializeDimensions(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductDimensions)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Dimensions)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.cs similarity index 82% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.cs index 8ea7597677f3..8f9f9fa9e823 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDimensions.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Dimensions.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Dimensions of a configuration. - public partial class ProductDimensions + public partial class Dimensions { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class ProductDimensions /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductDimensions() + /// Initializes a new instance of . + internal Dimensions() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Length of the device. /// Height of the device. /// Width of the device. @@ -59,7 +59,7 @@ internal ProductDimensions() /// Depth of the device. /// Unit for the dimensions of weight. /// Keeps track of any properties unknown to the library. - internal ProductDimensions(double? length, double? height, double? width, ProductLengthHeightWidthUnit? lengthHeightUnit, double? weight, double? depth, ProductWeightMeasurementUnit? weightUnit, IDictionary serializedAdditionalRawData) + internal Dimensions(double? length, double? height, double? width, LengthHeightUnit? lengthHeightUnit, double? weight, double? depth, WeightMeasurementUnit? weightUnit, IDictionary serializedAdditionalRawData) { Length = length; Height = height; @@ -78,12 +78,12 @@ internal ProductDimensions(double? length, double? height, double? width, Produc /// Width of the device. public double? Width { get; } /// Unit for the dimensions of length, height and width. - public ProductLengthHeightWidthUnit? LengthHeightUnit { get; } + public LengthHeightUnit? LengthHeightUnit { get; } /// Weight of the device. public double? Weight { get; } /// Depth of the device. public double? Depth { get; } /// Unit for the dimensions of weight. - public ProductWeightMeasurementUnit? WeightUnit { get; } + public WeightMeasurementUnit? WeightUnit { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisabledReason.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisabledReason.cs similarity index 51% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisabledReason.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisabledReason.cs index 053dacad0baa..833e0e18858c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisabledReason.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisabledReason.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Reason why the product is disabled. - public readonly partial struct ProductDisabledReason : IEquatable + public readonly partial struct DisabledReason : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public ProductDisabledReason(string value) + public DisabledReason(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -32,33 +32,33 @@ public ProductDisabledReason(string value) private const string OutOfStockValue = "OutOfStock"; /// Not disabled. - public static ProductDisabledReason None { get; } = new ProductDisabledReason(NoneValue); + public static DisabledReason None { get; } = new DisabledReason(NoneValue); /// Not available in the requested country. - public static ProductDisabledReason Country { get; } = new ProductDisabledReason(CountryValue); + public static DisabledReason Country { get; } = new DisabledReason(CountryValue); /// Not available to push data to the requested Azure region. - public static ProductDisabledReason Region { get; } = new ProductDisabledReason(RegionValue); + public static DisabledReason Region { get; } = new DisabledReason(RegionValue); /// Required features are not enabled. - public static ProductDisabledReason Feature { get; } = new ProductDisabledReason(FeatureValue); + public static DisabledReason Feature { get; } = new DisabledReason(FeatureValue); /// Subscription does not have required offer types. - public static ProductDisabledReason OfferType { get; } = new ProductDisabledReason(OfferTypeValue); + public static DisabledReason OfferType { get; } = new DisabledReason(OfferTypeValue); /// Subscription has not registered to Microsoft.DataBox and Service does not have the subscription notification. - public static ProductDisabledReason NoSubscriptionInfo { get; } = new ProductDisabledReason(NoSubscriptionInfoValue); + public static DisabledReason NoSubscriptionInfo { get; } = new DisabledReason(NoSubscriptionInfoValue); /// The product is not yet available. - public static ProductDisabledReason NotAvailable { get; } = new ProductDisabledReason(NotAvailableValue); + public static DisabledReason NotAvailable { get; } = new DisabledReason(NotAvailableValue); /// The product is out of stock. - public static ProductDisabledReason OutOfStock { get; } = new ProductDisabledReason(OutOfStockValue); - /// Determines if two values are the same. - public static bool operator ==(ProductDisabledReason left, ProductDisabledReason right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductDisabledReason left, ProductDisabledReason right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductDisabledReason(string value) => new ProductDisabledReason(value); + public static DisabledReason OutOfStock { get; } = new DisabledReason(OutOfStockValue); + /// Determines if two values are the same. + public static bool operator ==(DisabledReason left, DisabledReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DisabledReason left, DisabledReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DisabledReason(string value) => new DisabledReason(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductDisabledReason other && Equals(other); + public override bool Equals(object obj) => obj is DisabledReason other && Equals(other); /// - public bool Equals(ProductDisabledReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(DisabledReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.Serialization.cs similarity index 69% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.Serialization.cs index 3154695dbbdf..90b3598c9811 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductDisplayInfo : IUtf8JsonSerializable, IJsonModel + public partial class DisplayInfo : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDisplayInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DisplayInfo)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(ProductFamilyDisplayName)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductDisplayInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DisplayInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductDisplayInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DisplayInfo)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductDisplayInfo(document.RootElement, options); + return DeserializeDisplayInfo(document.RootElement, options); } - internal static ProductDisplayInfo DeserializeProductDisplayInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static DisplayInfo DeserializeDisplayInfo(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -103,38 +103,38 @@ internal static ProductDisplayInfo DeserializeProductDisplayInfo(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ProductDisplayInfo(productFamilyDisplayName, configurationDisplayName, serializedAdditionalRawData); + return new DisplayInfo(productFamilyDisplayName, configurationDisplayName, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductDisplayInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DisplayInfo)} does not support writing '{options.Format}' format."); } } - ProductDisplayInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DisplayInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductDisplayInfo(document.RootElement, options); + return DeserializeDisplayInfo(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductDisplayInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DisplayInfo)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.cs similarity index 84% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.cs index 28c94df895ab..2f1862b679cc 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDisplayInfo.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/DisplayInfo.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Describes product display information. - public partial class ProductDisplayInfo + public partial class DisplayInfo { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ProductDisplayInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ProductDisplayInfo() + /// Initializes a new instance of . + public DisplayInfo() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Product family display name. /// Configuration display name. /// Keeps track of any properties unknown to the library. - internal ProductDisplayInfo(string productFamilyDisplayName, string configurationDisplayName, IDictionary serializedAdditionalRawData) + internal DisplayInfo(string productFamilyDisplayName, string configurationDisplayName, IDictionary serializedAdditionalRawData) { ProductFamilyDisplayName = productFamilyDisplayName; ConfigurationDisplayName = configurationDisplayName; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderActionStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderActionStatus.cs deleted file mode 100644 index 643e60c9ac75..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderActionStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Describes whether the order item is deletable or not. - public readonly partial struct EdgeOrderActionStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderActionStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowedValue = "Allowed"; - private const string NotAllowedValue = "NotAllowed"; - - /// Allowed flag. - public static EdgeOrderActionStatus Allowed { get; } = new EdgeOrderActionStatus(AllowedValue); - /// Not Allowed flag. - public static EdgeOrderActionStatus NotAllowed { get; } = new EdgeOrderActionStatus(NotAllowedValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderActionStatus left, EdgeOrderActionStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderActionStatus left, EdgeOrderActionStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderActionStatus(string value) => new EdgeOrderActionStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderActionStatus other && Equals(other); - /// - public bool Equals(EdgeOrderActionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressType.cs deleted file mode 100644 index 0dac82d1eb7e..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Type of address. - public readonly partial struct EdgeOrderAddressType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderAddressType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "None"; - private const string ResidentialValue = "Residential"; - private const string CommercialValue = "Commercial"; - - /// Address type not known. - public static EdgeOrderAddressType None { get; } = new EdgeOrderAddressType(NoneValue); - /// Residential Address. - public static EdgeOrderAddressType Residential { get; } = new EdgeOrderAddressType(ResidentialValue); - /// Commercial Address. - public static EdgeOrderAddressType Commercial { get; } = new EdgeOrderAddressType(CommercialValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderAddressType left, EdgeOrderAddressType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderAddressType left, EdgeOrderAddressType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderAddressType(string value) => new EdgeOrderAddressType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderAddressType other && Equals(other); - /// - public bool Equals(EdgeOrderAddressType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressValidationStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressValidationStatus.cs deleted file mode 100644 index 3ff5b5de5e12..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderAddressValidationStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Status of address validation. - public readonly partial struct EdgeOrderAddressValidationStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderAddressValidationStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ValidValue = "Valid"; - private const string InvalidValue = "Invalid"; - private const string AmbiguousValue = "Ambiguous"; - - /// Address provided is valid. - public static EdgeOrderAddressValidationStatus Valid { get; } = new EdgeOrderAddressValidationStatus(ValidValue); - /// Address provided is invalid or not supported. - public static EdgeOrderAddressValidationStatus Invalid { get; } = new EdgeOrderAddressValidationStatus(InvalidValue); - /// Address provided is ambiguous, please choose one of the alternate addresses returned. - public static EdgeOrderAddressValidationStatus Ambiguous { get; } = new EdgeOrderAddressValidationStatus(AmbiguousValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderAddressValidationStatus left, EdgeOrderAddressValidationStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderAddressValidationStatus left, EdgeOrderAddressValidationStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderAddressValidationStatus(string value) => new EdgeOrderAddressValidationStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderAddressValidationStatus other && Equals(other); - /// - public bool Equals(EdgeOrderAddressValidationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.Serialization.cs deleted file mode 100644 index 4fd56b15b876..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.Serialization.cs +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - public partial class EdgeOrderProduct : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(EdgeOrderProduct)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteObjectValue(Description, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) - { - writer.WritePropertyName("imageInformation"u8); - writer.WriteStartArray(); - foreach (var item in ImageInformation) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CostInformation)) - { - writer.WritePropertyName("costInformation"u8); - writer.WriteObjectValue(CostInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) - { - writer.WritePropertyName("availabilityInformation"u8); - writer.WriteObjectValue(AvailabilityInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) - { - writer.WritePropertyName("hierarchyInformation"u8); - writer.WriteObjectValue(HierarchyInformation, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) - { - writer.WritePropertyName("filterableProperties"u8); - writer.WriteStartArray(); - foreach (var item in FilterableProperties) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Configurations)) - { - writer.WritePropertyName("configurations"u8); - writer.WriteStartArray(); - foreach (var item in Configurations) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - EdgeOrderProduct IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(EdgeOrderProduct)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProduct(document.RootElement, options); - } - - internal static EdgeOrderProduct DeserializeEdgeOrderProduct(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string displayName = default; - ProductDescription description = default; - IReadOnlyList imageInformation = default; - EdgeOrderProductCostInformation costInformation = default; - ProductAvailabilityInformation availabilityInformation = default; - HierarchyInformation hierarchyInformation = default; - IReadOnlyList filterableProperties = default; - IReadOnlyList configurations = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - description = ProductDescription.DeserializeProductDescription(property0.Value, options); - continue; - } - if (property0.NameEquals("imageInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EdgeOrderProductImageInformation.DeserializeEdgeOrderProductImageInformation(item, options)); - } - imageInformation = array; - continue; - } - if (property0.NameEquals("costInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - costInformation = EdgeOrderProductCostInformation.DeserializeEdgeOrderProductCostInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("availabilityInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityInformation = ProductAvailabilityInformation.DeserializeProductAvailabilityInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("hierarchyInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("filterableProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); - } - filterableProperties = array; - continue; - } - if (property0.NameEquals("configurations"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ProductConfiguration.DeserializeProductConfiguration(item, options)); - } - configurations = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderProduct( - displayName, - description, - imageInformation ?? new ChangeTrackingList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties ?? new ChangeTrackingList(), - configurations ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); - default: - throw new FormatException($"The model {nameof(EdgeOrderProduct)} does not support writing '{options.Format}' format."); - } - } - - EdgeOrderProduct IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProduct(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EdgeOrderProduct)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.cs deleted file mode 100644 index 405be06e85c6..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProduct.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// List of Products. - public partial class EdgeOrderProduct - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal EdgeOrderProduct() - { - ImageInformation = new ChangeTrackingList(); - FilterableProperties = new ChangeTrackingList(); - Configurations = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of configurations for the product. - /// Keeps track of any properties unknown to the library. - internal EdgeOrderProduct(string displayName, ProductDescription description, IReadOnlyList imageInformation, EdgeOrderProductCostInformation costInformation, ProductAvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList filterableProperties, IReadOnlyList configurations, IDictionary serializedAdditionalRawData) - { - DisplayName = displayName; - Description = description; - ImageInformation = imageInformation; - CostInformation = costInformation; - AvailabilityInformation = availabilityInformation; - HierarchyInformation = hierarchyInformation; - FilterableProperties = filterableProperties; - Configurations = configurations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Display Name for the product system. - public string DisplayName { get; } - /// Description related to the product system. - public ProductDescription Description { get; } - /// Image information for the product system. - public IReadOnlyList ImageInformation { get; } - /// Cost information for the product system. - public EdgeOrderProductCostInformation CostInformation { get; } - /// Availability information of the product system. - public ProductAvailabilityInformation AvailabilityInformation { get; } - /// Hierarchy information of a product. - public HierarchyInformation HierarchyInformation { get; } - /// list of filters supported for a product. - public IReadOnlyList FilterableProperties { get; } - /// List of configurations for the product. - public IReadOnlyList Configurations { get; } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductChargingType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductChargingType.cs deleted file mode 100644 index 4daa7801faa7..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductChargingType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Charging type. - public readonly partial struct EdgeOrderProductChargingType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderProductChargingType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PerOrderValue = "PerOrder"; - private const string PerDeviceValue = "PerDevice"; - - /// Per order charging type. - public static EdgeOrderProductChargingType PerOrder { get; } = new EdgeOrderProductChargingType(PerOrderValue); - /// Per device charging type. - public static EdgeOrderProductChargingType PerDevice { get; } = new EdgeOrderProductChargingType(PerDeviceValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderProductChargingType left, EdgeOrderProductChargingType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderProductChargingType left, EdgeOrderProductChargingType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderProductChargingType(string value) => new EdgeOrderProductChargingType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderProductChargingType other && Equals(other); - /// - public bool Equals(EdgeOrderProductChargingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageType.cs deleted file mode 100644 index b6ac92a8a5b6..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Type of the image. - public readonly partial struct EdgeOrderProductImageType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderProductImageType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MainImageValue = "MainImage"; - private const string BulletImageValue = "BulletImage"; - private const string GenericImageValue = "GenericImage"; - - /// Main image. - public static EdgeOrderProductImageType MainImage { get; } = new EdgeOrderProductImageType(MainImageValue); - /// Bullet image. - public static EdgeOrderProductImageType BulletImage { get; } = new EdgeOrderProductImageType(BulletImageValue); - /// Generic image. - public static EdgeOrderProductImageType GenericImage { get; } = new EdgeOrderProductImageType(GenericImageValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderProductImageType left, EdgeOrderProductImageType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderProductImageType left, EdgeOrderProductImageType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderProductImageType(string value) => new EdgeOrderProductImageType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderProductImageType other && Equals(other); - /// - public bool Equals(EdgeOrderProductImageType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeteringType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeteringType.cs deleted file mode 100644 index 312bef22a348..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeteringType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Represents Metering type (eg one-time or recurrent). - public readonly partial struct EdgeOrderProductMeteringType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderProductMeteringType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OneTimeValue = "OneTime"; - private const string RecurringValue = "Recurring"; - private const string AdhocValue = "Adhoc"; - - /// One time billing. - public static EdgeOrderProductMeteringType OneTime { get; } = new EdgeOrderProductMeteringType(OneTimeValue); - /// Recurring billing. - public static EdgeOrderProductMeteringType Recurring { get; } = new EdgeOrderProductMeteringType(RecurringValue); - /// Adhoc billing. - public static EdgeOrderProductMeteringType Adhoc { get; } = new EdgeOrderProductMeteringType(AdhocValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderProductMeteringType left, EdgeOrderProductMeteringType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderProductMeteringType left, EdgeOrderProductMeteringType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderProductMeteringType(string value) => new EdgeOrderProductMeteringType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderProductMeteringType other && Equals(other); - /// - public bool Equals(EdgeOrderProductMeteringType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageName.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageName.cs deleted file mode 100644 index ef33d91f0160..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageName.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Stage name. - public readonly partial struct EdgeOrderStageName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderStageName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PlacedValue = "Placed"; - private const string InReviewValue = "InReview"; - private const string ConfirmedValue = "Confirmed"; - private const string ReadyToShipValue = "ReadyToShip"; - private const string ShippedValue = "Shipped"; - private const string DeliveredValue = "Delivered"; - private const string InUseValue = "InUse"; - private const string ReturnInitiatedValue = "ReturnInitiated"; - private const string ReturnPickedUpValue = "ReturnPickedUp"; - private const string ReturnedToMicrosoftValue = "ReturnedToMicrosoft"; - private const string ReturnCompletedValue = "ReturnCompleted"; - private const string CancelledValue = "Cancelled"; - - /// Currently in draft mode and can still be cancelled. - public static EdgeOrderStageName Placed { get; } = new EdgeOrderStageName(PlacedValue); - /// Order is currently in draft mode and can still be cancelled. - public static EdgeOrderStageName InReview { get; } = new EdgeOrderStageName(InReviewValue); - /// Order is confirmed. - public static EdgeOrderStageName Confirmed { get; } = new EdgeOrderStageName(ConfirmedValue); - /// Order is ready to ship. - public static EdgeOrderStageName ReadyToShip { get; } = new EdgeOrderStageName(ReadyToShipValue); - /// Order is in transit to customer. - public static EdgeOrderStageName Shipped { get; } = new EdgeOrderStageName(ShippedValue); - /// Order is delivered to customer. - public static EdgeOrderStageName Delivered { get; } = new EdgeOrderStageName(DeliveredValue); - /// Order is in use at customer site. - public static EdgeOrderStageName InUse { get; } = new EdgeOrderStageName(InUseValue); - /// Return has been initiated by customer. - public static EdgeOrderStageName ReturnInitiated { get; } = new EdgeOrderStageName(ReturnInitiatedValue); - /// Order is in transit from customer to microsoft. - public static EdgeOrderStageName ReturnPickedUp { get; } = new EdgeOrderStageName(ReturnPickedUpValue); - /// Order has been received back to microsoft. - public static EdgeOrderStageName ReturnedToMicrosoft { get; } = new EdgeOrderStageName(ReturnedToMicrosoftValue); - /// Return has now completed. - public static EdgeOrderStageName ReturnCompleted { get; } = new EdgeOrderStageName(ReturnCompletedValue); - /// Order has been cancelled. - public static EdgeOrderStageName Cancelled { get; } = new EdgeOrderStageName(CancelledValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderStageName left, EdgeOrderStageName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderStageName left, EdgeOrderStageName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderStageName(string value) => new EdgeOrderStageName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderStageName other && Equals(other); - /// - public bool Equals(EdgeOrderStageName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageStatus.cs deleted file mode 100644 index 489bda8d0c85..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageStatus.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Stage status. - public readonly partial struct EdgeOrderStageStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EdgeOrderStageStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "None"; - private const string InProgressValue = "InProgress"; - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CancelledValue = "Cancelled"; - private const string CancellingValue = "Cancelling"; - - /// No status available yet. - public static EdgeOrderStageStatus None { get; } = new EdgeOrderStageStatus(NoneValue); - /// Stage is in progress. - public static EdgeOrderStageStatus InProgress { get; } = new EdgeOrderStageStatus(InProgressValue); - /// Stage has succeeded. - public static EdgeOrderStageStatus Succeeded { get; } = new EdgeOrderStageStatus(SucceededValue); - /// Stage has failed. - public static EdgeOrderStageStatus Failed { get; } = new EdgeOrderStageStatus(FailedValue); - /// Stage has been cancelled. - public static EdgeOrderStageStatus Cancelled { get; } = new EdgeOrderStageStatus(CancelledValue); - /// Stage is cancelling. - public static EdgeOrderStageStatus Cancelling { get; } = new EdgeOrderStageStatus(CancellingValue); - /// Determines if two values are the same. - public static bool operator ==(EdgeOrderStageStatus left, EdgeOrderStageStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EdgeOrderStageStatus left, EdgeOrderStageStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EdgeOrderStageStatus(string value) => new EdgeOrderStageStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EdgeOrderStageStatus other && Equals(other); - /// - public bool Equals(EdgeOrderStageStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.Serialization.cs index e5517d6b5a46..981651ec7fce 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.Serialization.cs @@ -35,7 +35,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("type"u8); - writer.WriteStringValue(SupportedFilterType.ToString()); + writer.WriteStringValue(Type.ToString()); writer.WritePropertyName("supportedValues"u8); writer.WriteStartArray(); foreach (var item in SupportedValues) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.cs index 031b94b5ac30..0020940362e1 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FilterableProperty.cs @@ -47,24 +47,24 @@ public partial class FilterableProperty private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Type of product filter. + /// Type of product filter. /// Values to be filtered. /// is null. - public FilterableProperty(SupportedFilterType supportedFilterType, IEnumerable supportedValues) + public FilterableProperty(SupportedFilterType type, IEnumerable supportedValues) { Argument.AssertNotNull(supportedValues, nameof(supportedValues)); - SupportedFilterType = supportedFilterType; + Type = type; SupportedValues = supportedValues.ToList(); } /// Initializes a new instance of . - /// Type of product filter. + /// Type of product filter. /// Values to be filtered. /// Keeps track of any properties unknown to the library. - internal FilterableProperty(SupportedFilterType supportedFilterType, IList supportedValues, IDictionary serializedAdditionalRawData) + internal FilterableProperty(SupportedFilterType type, IList supportedValues, IDictionary serializedAdditionalRawData) { - SupportedFilterType = supportedFilterType; + Type = type; SupportedValues = supportedValues; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -75,7 +75,7 @@ internal FilterableProperty() } /// Type of product filter. - public SupportedFilterType SupportedFilterType { get; set; } + public SupportedFilterType Type { get; set; } /// Values to be filtered. public IList SupportedValues { get; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.Serialization.cs index 89e85cc3686f..320f87b5928e 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.Serialization.cs @@ -52,7 +52,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(TrackingUri)) { writer.WritePropertyName("trackingUrl"u8); - writer.WriteStringValue(TrackingUri.AbsoluteUri); + writer.WriteStringValue(TrackingUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -94,7 +94,7 @@ internal static ForwardShippingDetails DeserializeForwardShippingDetails(JsonEle string carrierName = default; string carrierDisplayName = default; string trackingId = default; - Uri trackingUrl = default; + string trackingUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -116,11 +116,7 @@ internal static ForwardShippingDetails DeserializeForwardShippingDetails(JsonEle } if (property.NameEquals("trackingUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - trackingUrl = new Uri(property.Value.GetString()); + trackingUrl = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.cs index 833141c10a75..33dad18f6c8e 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ForwardShippingDetails.cs @@ -56,7 +56,7 @@ internal ForwardShippingDetails() /// TrackingId of the package. /// TrackingUrl of the package. /// Keeps track of any properties unknown to the library. - internal ForwardShippingDetails(string carrierName, string carrierDisplayName, string trackingId, Uri trackingUri, IDictionary serializedAdditionalRawData) + internal ForwardShippingDetails(string carrierName, string carrierDisplayName, string trackingId, string trackingUri, IDictionary serializedAdditionalRawData) { CarrierName = carrierName; CarrierDisplayName = carrierDisplayName; @@ -72,6 +72,6 @@ internal ForwardShippingDetails(string carrierName, string carrierDisplayName, s /// TrackingId of the package. public string TrackingId { get; } /// TrackingUrl of the package. - public Uri TrackingUri { get; } + public string TrackingUri { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FulfillmentType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FulfillmentType.cs new file mode 100644 index 000000000000..bdb781229a24 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/FulfillmentType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// The entity responsible for fulfillment of the item at the given hierarchy level. + public readonly partial struct FulfillmentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FulfillmentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MicrosoftValue = "Microsoft"; + private const string ExternalValue = "External"; + + /// The fulfillment (the whole journey of the product offering) is handled by microsoft. + public static FulfillmentType Microsoft { get; } = new FulfillmentType(MicrosoftValue); + /// The fulfillment (the whole journey of the product offering) is handled by external third party entities. + public static FulfillmentType External { get; } = new FulfillmentType(ExternalValue); + /// Determines if two values are the same. + public static bool operator ==(FulfillmentType left, FulfillmentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FulfillmentType left, FulfillmentType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FulfillmentType(string value) => new FulfillmentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FulfillmentType other && Equals(other); + /// + public bool Equals(FulfillmentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.Serialization.cs new file mode 100644 index 000000000000..f29727fe46ee --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class GroupedChildConfigurations : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupedChildConfigurations)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(CategoryInformation)) + { + writer.WritePropertyName("categoryInformation"u8); + writer.WriteObjectValue(CategoryInformation, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ChildConfigurations)) + { + writer.WritePropertyName("childConfigurations"u8); + writer.WriteStartArray(); + foreach (var item in ChildConfigurations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GroupedChildConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GroupedChildConfigurations)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGroupedChildConfigurations(document.RootElement, options); + } + + internal static GroupedChildConfigurations DeserializeGroupedChildConfigurations(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CategoryInformation categoryInformation = default; + IReadOnlyList childConfigurations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("categoryInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + categoryInformation = CategoryInformation.DeserializeCategoryInformation(property.Value, options); + continue; + } + if (property.NameEquals("childConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ChildConfiguration.DeserializeChildConfiguration(item, options)); + } + childConfigurations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GroupedChildConfigurations(categoryInformation, childConfigurations ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(GroupedChildConfigurations)} does not support writing '{options.Format}' format."); + } + } + + GroupedChildConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGroupedChildConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GroupedChildConfigurations)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.cs new file mode 100644 index 000000000000..046f0deb2a32 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/GroupedChildConfigurations.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Grouped child configuration object. + public partial class GroupedChildConfigurations + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal GroupedChildConfigurations() + { + ChildConfigurations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Category information. + /// List of child configurations. + /// Keeps track of any properties unknown to the library. + internal GroupedChildConfigurations(CategoryInformation categoryInformation, IReadOnlyList childConfigurations, IDictionary serializedAdditionalRawData) + { + CategoryInformation = categoryInformation; + ChildConfigurations = childConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Category information. + public CategoryInformation CategoryInformation { get; } + /// List of child configurations. + public IReadOnlyList ChildConfigurations { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.Serialization.cs index 22c4c1f015cb..fce20cfd1522 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.Serialization.cs @@ -54,6 +54,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("configurationName"u8); writer.WriteStringValue(ConfigurationName); } + if (Optional.IsDefined(ConfigurationIdDisplayName)) + { + writer.WritePropertyName("configurationIdDisplayName"u8); + writer.WriteStringValue(ConfigurationIdDisplayName); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -95,6 +100,7 @@ internal static HierarchyInformation DeserializeHierarchyInformation(JsonElement string productLineName = default; string productName = default; string configurationName = default; + string configurationIdDisplayName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -119,13 +125,24 @@ internal static HierarchyInformation DeserializeHierarchyInformation(JsonElement configurationName = property.Value.GetString(); continue; } + if (property.NameEquals("configurationIdDisplayName"u8)) + { + configurationIdDisplayName = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new HierarchyInformation(productFamilyName, productLineName, productName, configurationName, serializedAdditionalRawData); + return new HierarchyInformation( + productFamilyName, + productLineName, + productName, + configurationName, + configurationIdDisplayName, + serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.cs index 87dfd35a13d3..10939f6f1be8 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/HierarchyInformation.cs @@ -55,13 +55,15 @@ public HierarchyInformation() /// Represents product line name that uniquely identifies product line. /// Represents product name that uniquely identifies product. /// Represents configuration name that uniquely identifies configuration. + /// Represents Model Display Name. /// Keeps track of any properties unknown to the library. - internal HierarchyInformation(string productFamilyName, string productLineName, string productName, string configurationName, IDictionary serializedAdditionalRawData) + internal HierarchyInformation(string productFamilyName, string productLineName, string productName, string configurationName, string configurationIdDisplayName, IDictionary serializedAdditionalRawData) { ProductFamilyName = productFamilyName; ProductLineName = productLineName; ProductName = productName; ConfigurationName = configurationName; + ConfigurationIdDisplayName = configurationIdDisplayName; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -73,5 +75,7 @@ internal HierarchyInformation(string productFamilyName, string productLineName, public string ProductName { get; set; } /// Represents configuration name that uniquely identifies configuration. public string ConfigurationName { get; set; } + /// Represents Model Display Name. + public string ConfigurationIdDisplayName { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/IdentificationType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/IdentificationType.cs new file mode 100644 index 000000000000..bf580a276c24 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/IdentificationType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Identification type of the configuration. + public readonly partial struct IdentificationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IdentificationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSupportedValue = "NotSupported"; + private const string SerialNumberValue = "SerialNumber"; + + /// Product does not have any explicit identifier. + public static IdentificationType NotSupported { get; } = new IdentificationType(NotSupportedValue); + /// Product is identifiable by serial number. + public static IdentificationType SerialNumber { get; } = new IdentificationType(SerialNumberValue); + /// Determines if two values are the same. + public static bool operator ==(IdentificationType left, IdentificationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IdentificationType left, IdentificationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IdentificationType(string value) => new IdentificationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IdentificationType other && Equals(other); + /// + public bool Equals(IdentificationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.Serialization.cs similarity index 60% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.Serialization.cs index 23ce3bd265c8..14b1c320f495 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderProductImageInformation : IUtf8JsonSerializable, IJsonModel + public partial class ImageInformation : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductImageInformation)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ImageInformation)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(ImageType)) @@ -42,7 +42,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(ImageUri)) { writer.WritePropertyName("imageUrl"u8); - writer.WriteStringValue(ImageUri.AbsoluteUri); + writer.WriteStringValue(ImageUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderProductImageInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ImageInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductImageInformation)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ImageInformation)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductImageInformation(document.RootElement, options); + return DeserializeImageInformation(document.RootElement, options); } - internal static EdgeOrderProductImageInformation DeserializeEdgeOrderProductImageInformation(JsonElement element, ModelReaderWriterOptions options = null) + internal static ImageInformation DeserializeImageInformation(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static EdgeOrderProductImageInformation DeserializeEdgeOrderProductImag { return null; } - EdgeOrderProductImageType? imageType = default; - Uri imageUrl = default; + ImageType? imageType = default; + string imageUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,16 +93,12 @@ internal static EdgeOrderProductImageInformation DeserializeEdgeOrderProductImag { continue; } - imageType = new EdgeOrderProductImageType(property.Value.GetString()); + imageType = new ImageType(property.Value.GetString()); continue; } if (property.NameEquals("imageUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageUrl = new Uri(property.Value.GetString()); + imageUrl = property.Value.GetString(); continue; } if (options.Format != "W") @@ -111,38 +107,38 @@ internal static EdgeOrderProductImageInformation DeserializeEdgeOrderProductImag } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderProductImageInformation(imageType, imageUrl, serializedAdditionalRawData); + return new ImageInformation(imageType, imageUrl, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductImageInformation)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImageInformation)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductImageInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ImageInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductImageInformation(document.RootElement, options); + return DeserializeImageInformation(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductImageInformation)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImageInformation)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.cs similarity index 78% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.cs index 6e3bc1c5d7ce..9df6acba4037 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductImageInformation.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageInformation.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Image for the product. - public partial class EdgeOrderProductImageInformation + public partial class ImageInformation { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class EdgeOrderProductImageInformation /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal EdgeOrderProductImageInformation() + /// Initializes a new instance of . + internal ImageInformation() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Type of the image. /// Url of the image. /// Keeps track of any properties unknown to the library. - internal EdgeOrderProductImageInformation(EdgeOrderProductImageType? imageType, Uri imageUri, IDictionary serializedAdditionalRawData) + internal ImageInformation(ImageType? imageType, string imageUri, IDictionary serializedAdditionalRawData) { ImageType = imageType; ImageUri = imageUri; @@ -62,8 +62,8 @@ internal EdgeOrderProductImageInformation(EdgeOrderProductImageType? imageType, } /// Type of the image. - public EdgeOrderProductImageType? ImageType { get; } + public ImageType? ImageType { get; } /// Url of the image. - public Uri ImageUri { get; } + public string ImageUri { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageType.cs new file mode 100644 index 000000000000..cb382c98b102 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ImageType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Type of the image. + public readonly partial struct ImageType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ImageType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MainImageValue = "MainImage"; + private const string BulletImageValue = "BulletImage"; + private const string GenericImageValue = "GenericImage"; + + /// Main image. + public static ImageType MainImage { get; } = new ImageType(MainImageValue); + /// Bullet image. + public static ImageType BulletImage { get; } = new ImageType(BulletImageValue); + /// Generic image. + public static ImageType GenericImage { get; } = new ImageType(GenericImageValue); + /// Determines if two values are the same. + public static bool operator ==(ImageType left, ImageType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ImageType left, ImageType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ImageType(string value) => new ImageType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ImageType other && Equals(other); + /// + public bool Equals(ImageType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LengthHeightUnit.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LengthHeightUnit.cs new file mode 100644 index 000000000000..e7e37e641baa --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LengthHeightUnit.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Unit for the dimensions of length, height and width. + public readonly partial struct LengthHeightUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LengthHeightUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string INValue = "IN"; + private const string CMValue = "CM"; + + /// Inch, applicable for West US. + public static LengthHeightUnit IN { get; } = new LengthHeightUnit(INValue); + /// Centimeter. + public static LengthHeightUnit CM { get; } = new LengthHeightUnit(CMValue); + /// Determines if two values are the same. + public static bool operator ==(LengthHeightUnit left, LengthHeightUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LengthHeightUnit left, LengthHeightUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LengthHeightUnit(string value) => new LengthHeightUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LengthHeightUnit other && Equals(other); + /// + public bool Equals(LengthHeightUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.Serialization.cs similarity index 65% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.Serialization.cs index efc92122f85a..a42c7432f5fd 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductLink : IUtf8JsonSerializable, IJsonModel + public partial class Link : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductLink)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Link)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(LinkType)) @@ -42,7 +42,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(LinkUri)) { writer.WritePropertyName("linkUrl"u8); - writer.WriteStringValue(LinkUri.AbsoluteUri); + writer.WriteStringValue(LinkUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Link IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductLink)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Link)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductLink(document.RootElement, options); + return DeserializeLink(document.RootElement, options); } - internal static ProductLink DeserializeProductLink(JsonElement element, ModelReaderWriterOptions options = null) + internal static Link DeserializeLink(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static ProductLink DeserializeProductLink(JsonElement element, ModelRea { return null; } - ProductLinkType? linkType = default; - Uri linkUrl = default; + LinkType? linkType = default; + string linkUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,16 +93,12 @@ internal static ProductLink DeserializeProductLink(JsonElement element, ModelRea { continue; } - linkType = new ProductLinkType(property.Value.GetString()); + linkType = new LinkType(property.Value.GetString()); continue; } if (property.NameEquals("linkUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linkUrl = new Uri(property.Value.GetString()); + linkUrl = property.Value.GetString(); continue; } if (options.Format != "W") @@ -111,38 +107,38 @@ internal static ProductLink DeserializeProductLink(JsonElement element, ModelRea } } serializedAdditionalRawData = rawDataDictionary; - return new ProductLink(linkType, linkUrl, serializedAdditionalRawData); + return new Link(linkType, linkUrl, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductLink)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Link)} does not support writing '{options.Format}' format."); } } - ProductLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Link IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductLink(document.RootElement, options); + return DeserializeLink(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductLink)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Link)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.cs similarity index 82% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.cs index 8da45b495dea..1111f61eb033 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLink.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Link.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Returns link related to the product. - public partial class ProductLink + public partial class Link { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ProductLink /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductLink() + /// Initializes a new instance of . + internal Link() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Type of link. /// Url of the link. /// Keeps track of any properties unknown to the library. - internal ProductLink(ProductLinkType? linkType, Uri linkUri, IDictionary serializedAdditionalRawData) + internal Link(LinkType? linkType, string linkUri, IDictionary serializedAdditionalRawData) { LinkType = linkType; LinkUri = linkUri; @@ -62,8 +62,8 @@ internal ProductLink(ProductLinkType? linkType, Uri linkUri, IDictionary Type of link. - public ProductLinkType? LinkType { get; } + public LinkType? LinkType { get; } /// Url of the link. - public Uri LinkUri { get; } + public string LinkUri { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLinkType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LinkType.cs similarity index 50% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLinkType.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LinkType.cs index 42dd55a25b7e..776d70ecfa15 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLinkType.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/LinkType.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Type of link. - public readonly partial struct ProductLinkType : IEquatable + public readonly partial struct LinkType : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public ProductLinkType(string value) + public LinkType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -28,31 +28,34 @@ public ProductLinkType(string value) private const string DocumentationValue = "Documentation"; private const string KnowMoreValue = "KnowMore"; private const string SignUpValue = "SignUp"; + private const string DiscoverableValue = "Discoverable"; /// Generic link. - public static ProductLinkType Generic { get; } = new ProductLinkType(GenericValue); + public static LinkType Generic { get; } = new LinkType(GenericValue); /// Terms and conditions link. - public static ProductLinkType TermsAndConditions { get; } = new ProductLinkType(TermsAndConditionsValue); + public static LinkType TermsAndConditions { get; } = new LinkType(TermsAndConditionsValue); /// Link to product specification. - public static ProductLinkType Specification { get; } = new ProductLinkType(SpecificationValue); + public static LinkType Specification { get; } = new LinkType(SpecificationValue); /// Link to product documentation. - public static ProductLinkType Documentation { get; } = new ProductLinkType(DocumentationValue); + public static LinkType Documentation { get; } = new LinkType(DocumentationValue); /// Link to know more. - public static ProductLinkType KnowMore { get; } = new ProductLinkType(KnowMoreValue); + public static LinkType KnowMore { get; } = new LinkType(KnowMoreValue); /// Link to sign up for products. - public static ProductLinkType SignUp { get; } = new ProductLinkType(SignUpValue); - /// Determines if two values are the same. - public static bool operator ==(ProductLinkType left, ProductLinkType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductLinkType left, ProductLinkType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductLinkType(string value) => new ProductLinkType(value); + public static LinkType SignUp { get; } = new LinkType(SignUpValue); + /// Link to order the product from another source and not from Azure Edge Hardware Center. + public static LinkType Discoverable { get; } = new LinkType(DiscoverableValue); + /// Determines if two values are the same. + public static bool operator ==(LinkType left, LinkType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LinkType left, LinkType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LinkType(string value) => new LinkType(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductLinkType other && Equals(other); + public override bool Equals(object obj) => obj is LinkType other && Equals(other); /// - public bool Equals(ProductLinkType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(LinkType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.Serialization.cs similarity index 65% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.Serialization.cs index 136eb18088d1..2fddb8f84db0 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { [PersistableModelProxy(typeof(UnknownMeterDetails))] - public partial class EdgeOrderProductMeterDetails : IUtf8JsonSerializable, IJsonModel + public partial class MeterDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support writing '{format}' format."); } writer.WritePropertyName("billingType"u8); @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderProductMeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductMeterDetails(document.RootElement, options); + return DeserializeMeterDetails(document.RootElement, options); } - internal static EdgeOrderProductMeterDetails DeserializeEdgeOrderProductMeterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static MeterDetails DeserializeMeterDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -94,35 +94,35 @@ internal static EdgeOrderProductMeterDetails DeserializeEdgeOrderProductMeterDet return UnknownMeterDetails.DeserializeUnknownMeterDetails(element, options); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductMeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductMeterDetails(document.RootElement, options); + return DeserializeMeterDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.cs similarity index 74% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.cs index 0259f56624b0..7b2fc153ddfd 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderProductMeterDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeterDetails.cs @@ -11,11 +11,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// - /// Holds details about billing type and its meter guids - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Holds details about billing type and its meter guids. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - public abstract partial class EdgeOrderProductMeterDetails + public abstract partial class MeterDetails { /// /// Keeps track of any properties unknown to the library. @@ -49,17 +49,17 @@ public abstract partial class EdgeOrderProductMeterDetails /// private protected IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - protected EdgeOrderProductMeterDetails() + /// Initializes a new instance of . + protected MeterDetails() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Represents billing type. /// Billing unit applicable for Pav2 billing. /// Charging type. /// Keeps track of any properties unknown to the library. - internal EdgeOrderProductMeterDetails(BillingType billingType, double? multiplier, EdgeOrderProductChargingType? chargingType, IDictionary serializedAdditionalRawData) + internal MeterDetails(BillingType billingType, double? multiplier, ChargingType? chargingType, IDictionary serializedAdditionalRawData) { BillingType = billingType; Multiplier = multiplier; @@ -72,6 +72,6 @@ internal EdgeOrderProductMeterDetails(BillingType billingType, double? multiplie /// Billing unit applicable for Pav2 billing. public double? Multiplier { get; } /// Charging type. - public EdgeOrderProductChargingType? ChargingType { get; } + public ChargingType? ChargingType { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeteringType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeteringType.cs new file mode 100644 index 000000000000..4ebcaf6a576a --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/MeteringType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Represents Metering type (eg one-time or recurrent). + public readonly partial struct MeteringType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MeteringType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OneTimeValue = "OneTime"; + private const string RecurringValue = "Recurring"; + private const string AdhocValue = "Adhoc"; + + /// One time billing. + public static MeteringType OneTime { get; } = new MeteringType(OneTimeValue); + /// Recurring billing. + public static MeteringType Recurring { get; } = new MeteringType(RecurringValue); + /// Adhoc billing. + public static MeteringType Adhoc { get; } = new MeteringType(AdhocValue); + /// Determines if two values are the same. + public static bool operator ==(MeteringType left, MeteringType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MeteringType left, MeteringType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MeteringType(string value) => new MeteringType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MeteringType other && Equals(other); + /// + public bool Equals(MeteringType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.Serialization.cs index cc2d4d28bf65..46fc63fc55fd 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.Serialization.cs @@ -37,7 +37,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("stageName"u8); writer.WriteStringValue(StageName.ToString()); writer.WritePropertyName("sendNotification"u8); - writer.WriteBooleanValue(IsNotificationRequired); + writer.WriteBooleanValue(SendNotification); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.cs index a97007485910..04cb00df036d 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/NotificationPreference.cs @@ -47,21 +47,21 @@ public partial class NotificationPreference /// Initializes a new instance of . /// Name of the stage. - /// Notification is required or not. - public NotificationPreference(NotificationStageName stageName, bool isNotificationRequired) + /// Notification is required or not. + public NotificationPreference(NotificationStageName stageName, bool sendNotification) { StageName = stageName; - IsNotificationRequired = isNotificationRequired; + SendNotification = sendNotification; } /// Initializes a new instance of . /// Name of the stage. - /// Notification is required or not. + /// Notification is required or not. /// Keeps track of any properties unknown to the library. - internal NotificationPreference(NotificationStageName stageName, bool isNotificationRequired, IDictionary serializedAdditionalRawData) + internal NotificationPreference(NotificationStageName stageName, bool sendNotification, IDictionary serializedAdditionalRawData) { StageName = stageName; - IsNotificationRequired = isNotificationRequired; + SendNotification = sendNotification; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -73,6 +73,6 @@ internal NotificationPreference() /// Name of the stage. public NotificationStageName StageName { get; set; } /// Notification is required or not. - public bool IsNotificationRequired { get; set; } + public bool SendNotification { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.Serialization.cs new file mode 100644 index 000000000000..1fda61841d08 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class OkResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OkResponse)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OkResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OkResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOkResponse(document.RootElement, options); + } + + internal static OkResponse DeserializeOkResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OkResponse(serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(OkResponse)} does not support writing '{options.Format}' format."); + } + } + + OkResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOkResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OkResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.cs new file mode 100644 index 000000000000..7b4f4b111355 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OkResponse.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// The request has succeeded. + public partial class OkResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OkResponse() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal OkResponse(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationEnum.cs similarity index 56% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationStatus.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationEnum.cs index 849929f1217b..c5ccab0afbef 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationStatus.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemCancellationEnum.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Describes whether the order item is cancellable or not. - public readonly partial struct OrderItemCancellationStatus : IEquatable + public readonly partial struct OrderItemCancellationEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public OrderItemCancellationStatus(string value) + public OrderItemCancellationEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -27,23 +27,23 @@ public OrderItemCancellationStatus(string value) private const string NotCancellableValue = "NotCancellable"; /// Order item can be cancelled without fee. - public static OrderItemCancellationStatus Cancellable { get; } = new OrderItemCancellationStatus(CancellableValue); + public static OrderItemCancellationEnum Cancellable { get; } = new OrderItemCancellationEnum(CancellableValue); /// Order item can be cancelled with fee. - public static OrderItemCancellationStatus CancellableWithFee { get; } = new OrderItemCancellationStatus(CancellableWithFeeValue); + public static OrderItemCancellationEnum CancellableWithFee { get; } = new OrderItemCancellationEnum(CancellableWithFeeValue); /// Order item not cancellable. - public static OrderItemCancellationStatus NotCancellable { get; } = new OrderItemCancellationStatus(NotCancellableValue); - /// Determines if two values are the same. - public static bool operator ==(OrderItemCancellationStatus left, OrderItemCancellationStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(OrderItemCancellationStatus left, OrderItemCancellationStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator OrderItemCancellationStatus(string value) => new OrderItemCancellationStatus(value); + public static OrderItemCancellationEnum NotCancellable { get; } = new OrderItemCancellationEnum(NotCancellableValue); + /// Determines if two values are the same. + public static bool operator ==(OrderItemCancellationEnum left, OrderItemCancellationEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OrderItemCancellationEnum left, OrderItemCancellationEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OrderItemCancellationEnum(string value) => new OrderItemCancellationEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is OrderItemCancellationStatus other && Equals(other); + public override bool Equals(object obj) => obj is OrderItemCancellationEnum other && Equals(other); /// - public bool Equals(OrderItemCancellationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(OrderItemCancellationEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.Serialization.cs similarity index 76% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.Serialization.cs index 49e925ae25bd..71abf4b464f3 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemDetails : IUtf8JsonSerializable, IJsonModel + public partial class OrderItemDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemDetails)} does not support writing '{format}' format."); } writer.WritePropertyName("productDetails"u8); writer.WriteObjectValue(ProductDetails, options); writer.WritePropertyName("orderItemType"u8); writer.WriteStringValue(OrderItemType.ToString()); + if (Optional.IsDefined(OrderItemMode)) + { + writer.WritePropertyName("orderItemMode"u8); + writer.WriteStringValue(OrderItemMode.Value.ToString()); + } + if (Optional.IsDefined(SiteDetails)) + { + writer.WritePropertyName("siteDetails"u8); + writer.WriteObjectValue(SiteDetails, options); + } if (options.Format != "W" && Optional.IsDefined(CurrentStage)) { writer.WritePropertyName("currentStage"u8); @@ -103,16 +113,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("returnStatus"u8); writer.WriteStringValue(ReturnStatus.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(FirstOrDefaultManagement)) - { - writer.WritePropertyName("managementRpDetails"u8); - writer.WriteObjectValue(FirstOrDefaultManagement, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ManagementRPDetailsList)) + if (options.Format != "W" && Optional.IsCollectionDefined(ManagementRpDetailsList)) { writer.WritePropertyName("managementRpDetailsList"u8); writer.WriteStartArray(); - foreach (var item in ManagementRPDetailsList) + foreach (var item in ManagementRpDetailsList) { writer.WriteObjectValue(item, options); } @@ -140,19 +145,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OrderItemDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemDetails(document.RootElement, options); + return DeserializeOrderItemDetails(document.RootElement, options); } - internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static OrderItemDetails DeserializeOrderItemDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -162,19 +167,20 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement } ProductDetails productDetails = default; OrderItemType orderItemType = default; - EdgeOrderStageDetails currentStage = default; - IReadOnlyList orderItemStageHistory = default; - OrderItemPreferences preferences = default; + OrderMode? orderItemMode = default; + SiteDetails siteDetails = default; + StageDetails currentStage = default; + IReadOnlyList orderItemStageHistory = default; + Preferences preferences = default; ForwardShippingDetails forwardShippingDetails = default; ReverseShippingDetails reverseShippingDetails = default; IList notificationEmailList = default; string cancellationReason = default; - OrderItemCancellationStatus? cancellationStatus = default; - EdgeOrderActionStatus? deletionStatus = default; + OrderItemCancellationEnum? cancellationStatus = default; + ActionStatusEnum? deletionStatus = default; string returnReason = default; - OrderItemReturnStatus? returnStatus = default; - ResourceProviderDetails managementRPDetails = default; - IReadOnlyList managementRPDetailsList = default; + OrderItemReturnEnum? returnStatus = default; + IReadOnlyList managementRpDetailsList = default; ResponseError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -190,13 +196,31 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement orderItemType = new OrderItemType(property.Value.GetString()); continue; } + if (property.NameEquals("orderItemMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + orderItemMode = new OrderMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("siteDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + siteDetails = SiteDetails.DeserializeSiteDetails(property.Value, options); + continue; + } if (property.NameEquals("currentStage"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - currentStage = EdgeOrderStageDetails.DeserializeEdgeOrderStageDetails(property.Value, options); + currentStage = StageDetails.DeserializeStageDetails(property.Value, options); continue; } if (property.NameEquals("orderItemStageHistory"u8)) @@ -205,10 +229,10 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderStageDetails.DeserializeEdgeOrderStageDetails(item, options)); + array.Add(StageDetails.DeserializeStageDetails(item, options)); } orderItemStageHistory = array; continue; @@ -219,7 +243,7 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { continue; } - preferences = OrderItemPreferences.DeserializeOrderItemPreferences(property.Value, options); + preferences = Preferences.DeserializePreferences(property.Value, options); continue; } if (property.NameEquals("forwardShippingDetails"u8)) @@ -265,7 +289,7 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { continue; } - cancellationStatus = new OrderItemCancellationStatus(property.Value.GetString()); + cancellationStatus = new OrderItemCancellationEnum(property.Value.GetString()); continue; } if (property.NameEquals("deletionStatus"u8)) @@ -274,7 +298,7 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { continue; } - deletionStatus = new EdgeOrderActionStatus(property.Value.GetString()); + deletionStatus = new ActionStatusEnum(property.Value.GetString()); continue; } if (property.NameEquals("returnReason"u8)) @@ -288,16 +312,7 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { continue; } - returnStatus = new OrderItemReturnStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("managementRpDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managementRPDetails = ResourceProviderDetails.DeserializeResourceProviderDetails(property.Value, options); + returnStatus = new OrderItemReturnEnum(property.Value.GetString()); continue; } if (property.NameEquals("managementRpDetailsList"u8)) @@ -311,7 +326,7 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement { array.Add(ResourceProviderDetails.DeserializeResourceProviderDetails(item, options)); } - managementRPDetailsList = array; + managementRpDetailsList = array; continue; } if (property.NameEquals("error"u8)) @@ -329,11 +344,13 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemDetails( + return new OrderItemDetails( productDetails, orderItemType, + orderItemMode, + siteDetails, currentStage, - orderItemStageHistory ?? new ChangeTrackingList(), + orderItemStageHistory ?? new ChangeTrackingList(), preferences, forwardShippingDetails, reverseShippingDetails, @@ -343,41 +360,40 @@ internal static EdgeOrderItemDetails DeserializeEdgeOrderItemDetails(JsonElement deletionStatus, returnReason, returnStatus, - managementRPDetails, - managementRPDetailsList ?? new ChangeTrackingList(), + managementRpDetailsList ?? new ChangeTrackingList(), error, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OrderItemDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemDetails(document.RootElement, options); + return DeserializeOrderItemDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.cs similarity index 67% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.cs index 41bcbf903f5b..d89deea4605b 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Order item details. - public partial class EdgeOrderItemDetails + public partial class OrderItemDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,24 +45,26 @@ public partial class EdgeOrderItemDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Unique identifier for configuration. + /// Initializes a new instance of . + /// Represents product details. /// Order item type. /// is null. - public EdgeOrderItemDetails(ProductDetails productDetails, OrderItemType orderItemType) + public OrderItemDetails(ProductDetails productDetails, OrderItemType orderItemType) { Argument.AssertNotNull(productDetails, nameof(productDetails)); ProductDetails = productDetails; OrderItemType = orderItemType; - OrderItemStageHistory = new ChangeTrackingList(); + OrderItemStageHistory = new ChangeTrackingList(); NotificationEmailList = new ChangeTrackingList(); - ManagementRPDetailsList = new ChangeTrackingList(); + ManagementRpDetailsList = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Unique identifier for configuration. + /// Initializes a new instance of . + /// Represents product details. /// Order item type. + /// Defines the mode of the Order item. + /// Site Related Details. /// Current Order item Status. /// Order item status history. /// Customer notification Preferences. @@ -74,14 +76,15 @@ public EdgeOrderItemDetails(ProductDetails productDetails, OrderItemType orderIt /// Describes whether the order item is deletable or not. /// Return reason. /// Describes whether the order item is returnable or not. - /// Parent RP details - this returns only the first or default parent RP from the entire list. - /// List of parent RP details supported for configuration. + /// List of parent RP details supported for configuration. /// Top level error for the job. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemDetails(ProductDetails productDetails, OrderItemType orderItemType, EdgeOrderStageDetails currentStage, IReadOnlyList orderItemStageHistory, OrderItemPreferences preferences, ForwardShippingDetails forwardShippingDetails, ReverseShippingDetails reverseShippingDetails, IList notificationEmailList, string cancellationReason, OrderItemCancellationStatus? cancellationStatus, EdgeOrderActionStatus? deletionStatus, string returnReason, OrderItemReturnStatus? returnStatus, ResourceProviderDetails firstOrDefaultManagement, IReadOnlyList managementRPDetailsList, ResponseError error, IDictionary serializedAdditionalRawData) + internal OrderItemDetails(ProductDetails productDetails, OrderItemType orderItemType, OrderMode? orderItemMode, SiteDetails siteDetails, StageDetails currentStage, IReadOnlyList orderItemStageHistory, Preferences preferences, ForwardShippingDetails forwardShippingDetails, ReverseShippingDetails reverseShippingDetails, IList notificationEmailList, string cancellationReason, OrderItemCancellationEnum? cancellationStatus, ActionStatusEnum? deletionStatus, string returnReason, OrderItemReturnEnum? returnStatus, IReadOnlyList managementRpDetailsList, ResponseError error, IDictionary serializedAdditionalRawData) { ProductDetails = productDetails; OrderItemType = orderItemType; + OrderItemMode = orderItemMode; + SiteDetails = siteDetails; CurrentStage = currentStage; OrderItemStageHistory = orderItemStageHistory; Preferences = preferences; @@ -93,27 +96,37 @@ internal EdgeOrderItemDetails(ProductDetails productDetails, OrderItemType order DeletionStatus = deletionStatus; ReturnReason = returnReason; ReturnStatus = returnStatus; - FirstOrDefaultManagement = firstOrDefaultManagement; - ManagementRPDetailsList = managementRPDetailsList; + ManagementRpDetailsList = managementRpDetailsList; Error = error; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemDetails() + /// Initializes a new instance of for deserialization. + internal OrderItemDetails() { } - /// Unique identifier for configuration. + /// Represents product details. public ProductDetails ProductDetails { get; set; } /// Order item type. public OrderItemType OrderItemType { get; set; } + /// Defines the mode of the Order item. + public OrderMode? OrderItemMode { get; set; } + /// Site Related Details. + internal SiteDetails SiteDetails { get; set; } + /// Unique Id, Identifying A Site. + public string SiteId + { + get => SiteDetails is null ? default : SiteDetails.SiteId; + set => SiteDetails = new SiteDetails(value); + } + /// Current Order item Status. - public EdgeOrderStageDetails CurrentStage { get; } + public StageDetails CurrentStage { get; } /// Order item status history. - public IReadOnlyList OrderItemStageHistory { get; } + public IReadOnlyList OrderItemStageHistory { get; } /// Customer notification Preferences. - public OrderItemPreferences Preferences { get; set; } + public Preferences Preferences { get; set; } /// Forward Package Shipping details. public ForwardShippingDetails ForwardShippingDetails { get; } /// Reverse Package Shipping details. @@ -123,23 +136,15 @@ internal EdgeOrderItemDetails() /// Cancellation reason. public string CancellationReason { get; } /// Describes whether the order item is cancellable or not. - public OrderItemCancellationStatus? CancellationStatus { get; } + public OrderItemCancellationEnum? CancellationStatus { get; } /// Describes whether the order item is deletable or not. - public EdgeOrderActionStatus? DeletionStatus { get; } + public ActionStatusEnum? DeletionStatus { get; } /// Return reason. public string ReturnReason { get; } /// Describes whether the order item is returnable or not. - public OrderItemReturnStatus? ReturnStatus { get; } - /// Parent RP details - this returns only the first or default parent RP from the entire list. - internal ResourceProviderDetails FirstOrDefaultManagement { get; } - /// Resource provider namespace. - public string FirstOrDefaultManagementResourceProviderNamespace - { - get => FirstOrDefaultManagement?.ResourceProviderNamespace; - } - + public OrderItemReturnEnum? ReturnStatus { get; } /// List of parent RP details supported for configuration. - public IReadOnlyList ManagementRPDetailsList { get; } + public IReadOnlyList ManagementRpDetailsList { get; } /// Top level error for the job. public ResponseError Error { get; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.Serialization.cs new file mode 100644 index 000000000000..b09d60f3ea26 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class OrderItemDetailsUpdateParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrderItemDetailsUpdateParameter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ProductDetails)) + { + writer.WritePropertyName("productDetails"u8); + writer.WriteObjectValue(ProductDetails, options); + } + if (Optional.IsDefined(SiteDetails)) + { + writer.WritePropertyName("siteDetails"u8); + writer.WriteObjectValue(SiteDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OrderItemDetailsUpdateParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrderItemDetailsUpdateParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrderItemDetailsUpdateParameter(document.RootElement, options); + } + + internal static OrderItemDetailsUpdateParameter DeserializeOrderItemDetailsUpdateParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProductDetailsUpdateParameter productDetails = default; + SiteDetails siteDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("productDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + productDetails = ProductDetailsUpdateParameter.DeserializeProductDetailsUpdateParameter(property.Value, options); + continue; + } + if (property.NameEquals("siteDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + siteDetails = SiteDetails.DeserializeSiteDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OrderItemDetailsUpdateParameter(productDetails, siteDetails, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(OrderItemDetailsUpdateParameter)} does not support writing '{options.Format}' format."); + } + } + + OrderItemDetailsUpdateParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOrderItemDetailsUpdateParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrderItemDetailsUpdateParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.cs new file mode 100644 index 000000000000..b0704502ed4b --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemDetailsUpdateParameter.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Order item details Patchable Properties. + public partial class OrderItemDetailsUpdateParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public OrderItemDetailsUpdateParameter() + { + } + + /// Initializes a new instance of . + /// Represents product details. + /// Site Related Details. + /// Keeps track of any properties unknown to the library. + internal OrderItemDetailsUpdateParameter(ProductDetailsUpdateParameter productDetails, SiteDetails siteDetails, IDictionary serializedAdditionalRawData) + { + ProductDetails = productDetails; + SiteDetails = siteDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Represents product details. + internal ProductDetailsUpdateParameter ProductDetails { get; set; } + /// Device Provisioning Details for Parent. + public ProvisioningDetails ParentProvisioningDetails + { + get => ProductDetails is null ? default : ProductDetails.ParentProvisioningDetails; + set + { + if (ProductDetails is null) + ProductDetails = new ProductDetailsUpdateParameter(); + ProductDetails.ParentProvisioningDetails = value; + } + } + + /// Site Related Details. + internal SiteDetails SiteDetails { get; set; } + /// Unique Id, Identifying A Site. + public string SiteId + { + get => SiteDetails is null ? default : SiteDetails.SiteId; + set => SiteDetails = new SiteDetails(value); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.Serialization.cs index e300289402d7..16bf947e6e37 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(OrderItemResourceList)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -86,29 +86,29 @@ internal static OrderItemResourceList DeserializeOrderItemResourceList(JsonEleme { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderItemData.DeserializeEdgeOrderItemData(item, options)); + array.Add(OrderItemResourceData.DeserializeOrderItemResourceData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static OrderItemResourceList DeserializeOrderItemResourceList(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new OrderItemResourceList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new OrderItemResourceList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.cs index 1501eb329a5e..759af122f2d7 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourceList.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { - /// List of orderItems. + /// List of order items. internal partial class OrderItemResourceList { /// @@ -46,25 +47,31 @@ internal partial class OrderItemResourceList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal OrderItemResourceList() + /// The OrderItemResource items on this page. + internal OrderItemResourceList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of order item resources. - /// Link for the next set of order item resources. + /// The OrderItemResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal OrderItemResourceList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal OrderItemResourceList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of order item resources. - public IReadOnlyList Value { get; } - /// Link for the next set of order item resources. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal OrderItemResourceList() + { + } + + /// The OrderItemResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.Serialization.cs similarity index 64% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.Serialization.cs index b5c6a8258c8f..902c0131e456 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.Serialization.cs @@ -10,14 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemPatch : IUtf8JsonSerializable, IJsonModel + public partial class OrderItemResourcePatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourcePatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -45,6 +46,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ForwardAddress)) @@ -67,6 +73,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(OrderItemDetails)) + { + writer.WritePropertyName("orderItemDetails"u8); + writer.WriteObjectValue(OrderItemDetails, options); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -85,19 +96,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OrderItemResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourcePatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemPatch(document.RootElement, options); + return DeserializeOrderItemResourcePatch(document.RootElement, options); } - internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static OrderItemResourcePatch DeserializeOrderItemResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -106,9 +117,11 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele return null; } IDictionary tags = default; - EdgeOrderItemAddressProperties forwardAddress = default; - OrderItemPreferences preferences = default; + ManagedServiceIdentity identity = default; + AddressProperties forwardAddress = default; + Preferences preferences = default; IList notificationEmailList = default; + OrderItemDetailsUpdateParameter orderItemDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -127,6 +140,15 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele tags = dictionary; continue; } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -142,7 +164,7 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele { continue; } - forwardAddress = EdgeOrderItemAddressProperties.DeserializeEdgeOrderItemAddressProperties(property0.Value, options); + forwardAddress = AddressProperties.DeserializeAddressProperties(property0.Value, options); continue; } if (property0.NameEquals("preferences"u8)) @@ -151,7 +173,7 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele { continue; } - preferences = OrderItemPreferences.DeserializeOrderItemPreferences(property0.Value, options); + preferences = Preferences.DeserializePreferences(property0.Value, options); continue; } if (property0.NameEquals("notificationEmailList"u8)) @@ -168,6 +190,15 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele notificationEmailList = array; continue; } + if (property0.NameEquals("orderItemDetails"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + orderItemDetails = OrderItemDetailsUpdateParameter.DeserializeOrderItemDetailsUpdateParameter(property0.Value, options); + continue; + } } continue; } @@ -177,38 +208,45 @@ internal static EdgeOrderItemPatch DeserializeEdgeOrderItemPatch(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemPatch(tags ?? new ChangeTrackingDictionary(), forwardAddress, preferences, notificationEmailList ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new OrderItemResourcePatch( + forwardAddress, + preferences, + notificationEmailList ?? new ChangeTrackingList(), + orderItemDetails, + tags ?? new ChangeTrackingDictionary(), + identity, + serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourcePatch)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OrderItemResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemPatch(document.RootElement, options); + return DeserializeOrderItemResourcePatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourcePatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.cs similarity index 71% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.cs index 810b62b5a0e0..af9332b7912b 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemPatch.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemResourcePatch.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.EdgeOrder.Models { /// Updates order item parameters. - public partial class EdgeOrderItemPatch + public partial class OrderItemResourcePatch { /// /// Keeps track of any properties unknown to the library. @@ -45,35 +46,43 @@ public partial class EdgeOrderItemPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public EdgeOrderItemPatch() + /// Initializes a new instance of . + public OrderItemResourcePatch() { - Tags = new ChangeTrackingDictionary(); NotificationEmailList = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . - /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + /// Initializes a new instance of . /// Updates forward shipping address and contact details. /// Customer preference. /// Additional notification email list. + /// Represents order item details. + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + /// Msi identity of the resource. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemPatch(IDictionary tags, EdgeOrderItemAddressProperties forwardAddress, OrderItemPreferences preferences, IList notificationEmailList, IDictionary serializedAdditionalRawData) + internal OrderItemResourcePatch(AddressProperties forwardAddress, Preferences preferences, IList notificationEmailList, OrderItemDetailsUpdateParameter orderItemDetails, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) { - Tags = tags; ForwardAddress = forwardAddress; Preferences = preferences; NotificationEmailList = notificationEmailList; + OrderItemDetails = orderItemDetails; + Tags = tags; + Identity = identity; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 IDictionary Tags { get; } /// Updates forward shipping address and contact details. - public EdgeOrderItemAddressProperties ForwardAddress { get; set; } + public AddressProperties ForwardAddress { get; set; } /// Customer preference. - public OrderItemPreferences Preferences { get; set; } + public Preferences Preferences { get; set; } /// Additional notification email list. public IList NotificationEmailList { get; } + /// Represents order item details. + public OrderItemDetailsUpdateParameter OrderItemDetails { 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). + public IDictionary Tags { get; } + /// Msi identity of the resource. + public ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnEnum.cs similarity index 58% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnStatus.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnEnum.cs index 532c8cbc7c9e..44c6a0bfc24a 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnStatus.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemReturnEnum.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Describes whether the order item is returnable or not. - public readonly partial struct OrderItemReturnStatus : IEquatable + public readonly partial struct OrderItemReturnEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public OrderItemReturnStatus(string value) + public OrderItemReturnEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -27,23 +27,23 @@ public OrderItemReturnStatus(string value) private const string NotReturnableValue = "NotReturnable"; /// Order item can be returned without fee. - public static OrderItemReturnStatus Returnable { get; } = new OrderItemReturnStatus(ReturnableValue); + public static OrderItemReturnEnum Returnable { get; } = new OrderItemReturnEnum(ReturnableValue); /// Order item can be returned with fee. - public static OrderItemReturnStatus ReturnableWithFee { get; } = new OrderItemReturnStatus(ReturnableWithFeeValue); + public static OrderItemReturnEnum ReturnableWithFee { get; } = new OrderItemReturnEnum(ReturnableWithFeeValue); /// Order item not returnable. - public static OrderItemReturnStatus NotReturnable { get; } = new OrderItemReturnStatus(NotReturnableValue); - /// Determines if two values are the same. - public static bool operator ==(OrderItemReturnStatus left, OrderItemReturnStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(OrderItemReturnStatus left, OrderItemReturnStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator OrderItemReturnStatus(string value) => new OrderItemReturnStatus(value); + public static OrderItemReturnEnum NotReturnable { get; } = new OrderItemReturnEnum(NotReturnableValue); + /// Determines if two values are the same. + public static bool operator ==(OrderItemReturnEnum left, OrderItemReturnEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OrderItemReturnEnum left, OrderItemReturnEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OrderItemReturnEnum(string value) => new OrderItemReturnEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is OrderItemReturnStatus other && Equals(other); + public override bool Equals(object obj) => obj is OrderItemReturnEnum other && Equals(other); /// - public bool Equals(OrderItemReturnStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(OrderItemReturnEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemType.cs index 52372ab9f79c..3f8c7955d094 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemType.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemType.cs @@ -24,11 +24,14 @@ public OrderItemType(string value) private const string PurchaseValue = "Purchase"; private const string RentalValue = "Rental"; + private const string ExternalValue = "External"; /// Purchase OrderItem. public static OrderItemType Purchase { get; } = new OrderItemType(PurchaseValue); /// Rental OrderItem. public static OrderItemType Rental { get; } = new OrderItemType(RentalValue); + /// Orders placed outside of azure. + public static OrderItemType External { get; } = new OrderItemType(ExternalValue); /// Determines if two values are the same. public static bool operator ==(OrderItemType left, OrderItemType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderMode.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderMode.cs new file mode 100644 index 000000000000..3450e6429a6c --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Defines the mode of the Order item. + public readonly partial struct OrderMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OrderMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string DoNotFulfillValue = "DoNotFulfill"; + + /// Default Order mode. + public static OrderMode Default { get; } = new OrderMode(DefaultValue); + /// Mode in which the Order will not be fulfilled. + public static OrderMode DoNotFulfill { get; } = new OrderMode(DoNotFulfillValue); + /// Determines if two values are the same. + public static bool operator ==(OrderMode left, OrderMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OrderMode left, OrderMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OrderMode(string value) => new OrderMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OrderMode other && Equals(other); + /// + public bool Equals(OrderMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.Serialization.cs index 60f186e4fafb..c0627a5bc3d8 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(OrderResourceList)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -86,29 +86,29 @@ internal static OrderResourceList DeserializeOrderResourceList(JsonElement eleme { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderData.DeserializeEdgeOrderData(item, options)); + array.Add(OrderResourceData.DeserializeOrderResourceData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static OrderResourceList DeserializeOrderResourceList(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new OrderResourceList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new OrderResourceList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.cs index 2583dfcb18be..caa856cdc21f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderResourceList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { @@ -46,25 +47,31 @@ internal partial class OrderResourceList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal OrderResourceList() + /// The OrderResource items on this page. + internal OrderResourceList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of order resources. - /// Link for the next set of order resources. + /// The OrderResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal OrderResourceList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal OrderResourceList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of order resources. - public IReadOnlyList Value { get; } - /// Link for the next set of order resources. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal OrderResourceList() + { + } + + /// The OrderResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.Serialization.cs index 1514b6f0fdb4..b041d5e6161f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.Serialization.cs @@ -38,7 +38,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (options.Format != "W" && Optional.IsDefined(MeterGuid)) { writer.WritePropertyName("meterGuid"u8); - writer.WriteStringValue(MeterGuid.Value); + writer.WriteStringValue(MeterGuid); } } @@ -62,21 +62,17 @@ internal static Pav2MeterDetails DeserializePav2MeterDetails(JsonElement element { return null; } - Guid? meterGuid = default; + string meterGuid = default; BillingType billingType = default; double? multiplier = default; - EdgeOrderProductChargingType? chargingType = default; + ChargingType? chargingType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterGuid"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - meterGuid = property.Value.GetGuid(); + meterGuid = property.Value.GetString(); continue; } if (property.NameEquals("billingType"u8)) @@ -99,7 +95,7 @@ internal static Pav2MeterDetails DeserializePav2MeterDetails(JsonElement element { continue; } - chargingType = new EdgeOrderProductChargingType(property.Value.GetString()); + chargingType = new ChargingType(property.Value.GetString()); continue; } if (options.Format != "W") diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.cs index c2ae28c44e55..a9f783e5412f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Pav2MeterDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Billing type PAV2 meter details. - public partial class Pav2MeterDetails : EdgeOrderProductMeterDetails + public partial class Pav2MeterDetails : MeterDetails { /// Initializes a new instance of . internal Pav2MeterDetails() @@ -25,13 +25,13 @@ internal Pav2MeterDetails() /// Charging type. /// Keeps track of any properties unknown to the library. /// Validation status of requested data center and transport. - internal Pav2MeterDetails(BillingType billingType, double? multiplier, EdgeOrderProductChargingType? chargingType, IDictionary serializedAdditionalRawData, Guid? meterGuid) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) + internal Pav2MeterDetails(BillingType billingType, double? multiplier, ChargingType? chargingType, IDictionary serializedAdditionalRawData, string meterGuid) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) { MeterGuid = meterGuid; BillingType = billingType; } /// Validation status of requested data center and transport. - public Guid? MeterGuid { get; } + public string MeterGuid { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.Serialization.cs similarity index 70% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.Serialization.cs index 3b2c26f2b681..2bf81c55e611 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class OrderItemPreferences : IUtf8JsonSerializable, IJsonModel + public partial class Preferences : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OrderItemPreferences)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Preferences)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(NotificationPreferences)) @@ -59,6 +59,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("managementResourcePreferences"u8); writer.WriteObjectValue(ManagementResourcePreferences, options); } + if (Optional.IsDefined(TermCommitmentPreferences)) + { + writer.WritePropertyName("termCommitmentPreferences"u8); + writer.WriteObjectValue(TermCommitmentPreferences, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -76,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - OrderItemPreferences IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Preferences IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OrderItemPreferences)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Preferences)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOrderItemPreferences(document.RootElement, options); + return DeserializePreferences(document.RootElement, options); } - internal static OrderItemPreferences DeserializeOrderItemPreferences(JsonElement element, ModelReaderWriterOptions options = null) + internal static Preferences DeserializePreferences(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -100,6 +105,7 @@ internal static OrderItemPreferences DeserializeOrderItemPreferences(JsonElement TransportPreferences transportPreferences = default; EncryptionPreferences encryptionPreferences = default; ManagementResourcePreferences managementResourcePreferences = default; + TermCommitmentPreferences termCommitmentPreferences = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -145,44 +151,59 @@ internal static OrderItemPreferences DeserializeOrderItemPreferences(JsonElement managementResourcePreferences = ManagementResourcePreferences.DeserializeManagementResourcePreferences(property.Value, options); continue; } + if (property.NameEquals("termCommitmentPreferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termCommitmentPreferences = TermCommitmentPreferences.DeserializeTermCommitmentPreferences(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new OrderItemPreferences(notificationPreferences ?? new ChangeTrackingList(), transportPreferences, encryptionPreferences, managementResourcePreferences, serializedAdditionalRawData); + return new Preferences( + notificationPreferences ?? new ChangeTrackingList(), + transportPreferences, + encryptionPreferences, + managementResourcePreferences, + termCommitmentPreferences, + serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(OrderItemPreferences)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Preferences)} does not support writing '{options.Format}' format."); } } - OrderItemPreferences IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Preferences IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOrderItemPreferences(document.RootElement, options); + return DeserializePreferences(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OrderItemPreferences)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Preferences)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.cs similarity index 84% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.cs index d0531956b15f..b2fe50959092 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/OrderItemPreferences.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Preferences.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Preferences related to the order. - public partial class OrderItemPreferences + public partial class Preferences { /// /// Keeps track of any properties unknown to the library. @@ -45,24 +45,26 @@ public partial class OrderItemPreferences /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public OrderItemPreferences() + /// Initializes a new instance of . + public Preferences() { NotificationPreferences = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Notification preferences. /// Preferences related to the shipment logistics of the order. /// Preferences related to the Encryption. /// Preferences related to the Management resource. + /// Preferences related to the Term commitment. /// Keeps track of any properties unknown to the library. - internal OrderItemPreferences(IList notificationPreferences, TransportPreferences transportPreferences, EncryptionPreferences encryptionPreferences, ManagementResourcePreferences managementResourcePreferences, IDictionary serializedAdditionalRawData) + internal Preferences(IList notificationPreferences, TransportPreferences transportPreferences, EncryptionPreferences encryptionPreferences, ManagementResourcePreferences managementResourcePreferences, TermCommitmentPreferences termCommitmentPreferences, IDictionary serializedAdditionalRawData) { NotificationPreferences = notificationPreferences; TransportPreferences = transportPreferences; EncryptionPreferences = encryptionPreferences; ManagementResourcePreferences = managementResourcePreferences; + TermCommitmentPreferences = termCommitmentPreferences; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -107,5 +109,8 @@ public string PreferredManagementResourceId ManagementResourcePreferences.PreferredManagementResourceId = value; } } + + /// Preferences related to the Term commitment. + public TermCommitmentPreferences TermCommitmentPreferences { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.Serialization.cs new file mode 100644 index 000000000000..1c42788329e5 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class Product : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Product)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(Configurations)) + { + writer.WritePropertyName("configurations"u8); + writer.WriteStartArray(); + foreach (var item in Configurations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Product IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Product)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProduct(document.RootElement, options); + } + + internal static Product DeserializeProduct(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList configurations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("configurations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Configuration.DeserializeConfiguration(item, options)); + } + configurations = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Product(configurations ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(Product)} does not support writing '{options.Format}' format."); + } + } + + Product IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProduct(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Product)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.cs similarity index 68% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.cs index 14a1f3aabdcb..3e8878fa4651 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfigurations.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Product.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - /// The list of configurations. - internal partial class ProductConfigurations + /// Represents a product. + public partial class Product { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +45,22 @@ internal partial class ProductConfigurations /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductConfigurations() + /// Initializes a new instance of . + internal Product() { - Value = new ChangeTrackingList(); + Configurations = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// List of configurations. - /// Link for the next set of configurations. + /// Initializes a new instance of . + /// List of configurations for the product. /// Keeps track of any properties unknown to the library. - internal ProductConfigurations(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal Product(IReadOnlyList configurations, IDictionary serializedAdditionalRawData) { - Value = value; - NextLink = nextLink; + Configurations = configurations; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of configurations. - public IReadOnlyList Value { get; } - /// Link for the next set of configurations. - public string NextLink { get; } + /// List of configurations for the product. + public IReadOnlyList Configurations { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityStage.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityStage.cs deleted file mode 100644 index ec378b86420d..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductAvailabilityStage.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Current availability stage of the product. Availability stage. - public readonly partial struct ProductAvailabilityStage : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ProductAvailabilityStage(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AvailableValue = "Available"; - private const string ComingSoonValue = "ComingSoon"; - private const string PreviewValue = "Preview"; - private const string DeprecatedValue = "Deprecated"; - private const string SignUpValue = "Signup"; - private const string UnavailableValue = "Unavailable"; - - /// Product is available. - public static ProductAvailabilityStage Available { get; } = new ProductAvailabilityStage(AvailableValue); - /// Product is coming soon. - public static ProductAvailabilityStage ComingSoon { get; } = new ProductAvailabilityStage(ComingSoonValue); - /// Product is in preview. - public static ProductAvailabilityStage Preview { get; } = new ProductAvailabilityStage(PreviewValue); - /// Product is deprecated. - public static ProductAvailabilityStage Deprecated { get; } = new ProductAvailabilityStage(DeprecatedValue); - /// Product is available only on signup. - public static ProductAvailabilityStage SignUp { get; } = new ProductAvailabilityStage(SignUpValue); - /// Product is not available. - public static ProductAvailabilityStage Unavailable { get; } = new ProductAvailabilityStage(UnavailableValue); - /// Determines if two values are the same. - public static bool operator ==(ProductAvailabilityStage left, ProductAvailabilityStage right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductAvailabilityStage left, ProductAvailabilityStage right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductAvailabilityStage(string value) => new ProductAvailabilityStage(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductAvailabilityStage other && Equals(other); - /// - public bool Equals(ProductAvailabilityStage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.cs deleted file mode 100644 index ff56e28cd795..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductConfiguration.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Configuration object. - public partial class ProductConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal ProductConfiguration() - { - ImageInformation = new ChangeTrackingList(); - FilterableProperties = new ChangeTrackingList(); - Specifications = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// Specifications of the configuration. - /// Dimensions of the configuration. - /// Keeps track of any properties unknown to the library. - internal ProductConfiguration(string displayName, ProductDescription description, IReadOnlyList imageInformation, EdgeOrderProductCostInformation costInformation, ProductAvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList filterableProperties, IReadOnlyList specifications, ProductDimensions dimensions, IDictionary serializedAdditionalRawData) - { - DisplayName = displayName; - Description = description; - ImageInformation = imageInformation; - CostInformation = costInformation; - AvailabilityInformation = availabilityInformation; - HierarchyInformation = hierarchyInformation; - FilterableProperties = filterableProperties; - Specifications = specifications; - Dimensions = dimensions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Display Name for the product system. - public string DisplayName { get; } - /// Description related to the product system. - public ProductDescription Description { get; } - /// Image information for the product system. - public IReadOnlyList ImageInformation { get; } - /// Cost information for the product system. - public EdgeOrderProductCostInformation CostInformation { get; } - /// Availability information of the product system. - public ProductAvailabilityInformation AvailabilityInformation { get; } - /// Hierarchy information of a product. - public HierarchyInformation HierarchyInformation { get; } - /// list of filters supported for a product. - public IReadOnlyList FilterableProperties { get; } - /// Specifications of the configuration. - public IReadOnlyList Specifications { get; } - /// Dimensions of the configuration. - public ProductDimensions Dimensions { get; } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescriptionType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescriptionType.cs deleted file mode 100644 index 72ed959134d7..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDescriptionType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Type of description. - public readonly partial struct ProductDescriptionType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ProductDescriptionType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string BaseValue = "Base"; - - /// Base description. - public static ProductDescriptionType Base { get; } = new ProductDescriptionType(BaseValue); - /// Determines if two values are the same. - public static bool operator ==(ProductDescriptionType left, ProductDescriptionType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductDescriptionType left, ProductDescriptionType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductDescriptionType(string value) => new ProductDescriptionType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductDescriptionType other && Equals(other); - /// - public bool Equals(ProductDescriptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.Serialization.cs index 80bca8ced9e1..80ca2fe05456 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.Serialization.cs @@ -41,26 +41,51 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("hierarchyInformation"u8); writer.WriteObjectValue(HierarchyInformation, options); - if (options.Format != "W" && Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } if (options.Format != "W" && Optional.IsDefined(ProductDoubleEncryptionStatus)) { writer.WritePropertyName("productDoubleEncryptionStatus"u8); writer.WriteStringValue(ProductDoubleEncryptionStatus.Value.ToString()); } - if (options.Format != "W" && Optional.IsCollectionDefined(DeviceDetails)) + if (options.Format != "W" && Optional.IsDefined(IdentificationType)) + { + writer.WritePropertyName("identificationType"u8); + writer.WriteStringValue(IdentificationType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ParentDeviceDetails)) + { + writer.WritePropertyName("parentDeviceDetails"u8); + writer.WriteObjectValue(ParentDeviceDetails, options); + } + if (Optional.IsDefined(ParentProvisioningDetails)) + { + writer.WritePropertyName("parentProvisioningDetails"u8); + writer.WriteObjectValue(ParentProvisioningDetails, options); + } + if (Optional.IsCollectionDefined(OptInAdditionalConfigurations)) + { + writer.WritePropertyName("optInAdditionalConfigurations"u8); + writer.WriteStartArray(); + foreach (var item in OptInAdditionalConfigurations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ChildConfigurationDeviceDetails)) { - writer.WritePropertyName("deviceDetails"u8); + writer.WritePropertyName("childConfigurationDeviceDetails"u8); writer.WriteStartArray(); - foreach (var item in DeviceDetails) + foreach (var item in ChildConfigurationDeviceDetails) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsDefined(TermCommitmentInformation)) + { + writer.WritePropertyName("termCommitmentInformation"u8); + writer.WriteObjectValue(TermCommitmentInformation, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -98,11 +123,15 @@ internal static ProductDetails DeserializeProductDetails(JsonElement element, Mo { return null; } - ProductDisplayInfo displayInfo = default; + DisplayInfo displayInfo = default; HierarchyInformation hierarchyInformation = default; - int? count = default; DoubleEncryptionStatus? productDoubleEncryptionStatus = default; - IReadOnlyList deviceDetails = default; + IdentificationType? identificationType = default; + DeviceDetails parentDeviceDetails = default; + ProvisioningDetails parentProvisioningDetails = default; + IList optInAdditionalConfigurations = default; + IReadOnlyList childConfigurationDeviceDetails = default; + TermCommitmentInformation termCommitmentInformation = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -113,7 +142,7 @@ internal static ProductDetails DeserializeProductDetails(JsonElement element, Mo { continue; } - displayInfo = ProductDisplayInfo.DeserializeProductDisplayInfo(property.Value, options); + displayInfo = DisplayInfo.DeserializeDisplayInfo(property.Value, options); continue; } if (property.NameEquals("hierarchyInformation"u8)) @@ -121,36 +150,77 @@ internal static ProductDetails DeserializeProductDetails(JsonElement element, Mo hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property.Value, options); continue; } - if (property.NameEquals("count"u8)) + if (property.NameEquals("productDoubleEncryptionStatus"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - count = property.Value.GetInt32(); + productDoubleEncryptionStatus = new DoubleEncryptionStatus(property.Value.GetString()); continue; } - if (property.NameEquals("productDoubleEncryptionStatus"u8)) + if (property.NameEquals("identificationType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - productDoubleEncryptionStatus = new DoubleEncryptionStatus(property.Value.GetString()); + identificationType = new IdentificationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("parentDeviceDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parentDeviceDetails = DeviceDetails.DeserializeDeviceDetails(property.Value, options); + continue; + } + if (property.NameEquals("parentProvisioningDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parentProvisioningDetails = ProvisioningDetails.DeserializeProvisioningDetails(property.Value, options); + continue; + } + if (property.NameEquals("optInAdditionalConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AdditionalConfiguration.DeserializeAdditionalConfiguration(item, options)); + } + optInAdditionalConfigurations = array; continue; } - if (property.NameEquals("deviceDetails"u8)) + if (property.NameEquals("childConfigurationDeviceDetails"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(EdgeOrderProductDeviceDetails.DeserializeEdgeOrderProductDeviceDetails(item, options)); + array.Add(ConfigurationDeviceDetails.DeserializeConfigurationDeviceDetails(item, options)); + } + childConfigurationDeviceDetails = array; + continue; + } + if (property.NameEquals("termCommitmentInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; } - deviceDetails = array; + termCommitmentInformation = TermCommitmentInformation.DeserializeTermCommitmentInformation(property.Value, options); continue; } if (options.Format != "W") @@ -162,9 +232,13 @@ internal static ProductDetails DeserializeProductDetails(JsonElement element, Mo return new ProductDetails( displayInfo, hierarchyInformation, - count, productDoubleEncryptionStatus, - deviceDetails ?? new ChangeTrackingList(), + identificationType, + parentDeviceDetails, + parentProvisioningDetails, + optInAdditionalConfigurations ?? new ChangeTrackingList(), + childConfigurationDeviceDetails ?? new ChangeTrackingList(), + termCommitmentInformation, serializedAdditionalRawData); } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.cs index 96ba4b3d23d3..532de397f382 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetails.cs @@ -53,23 +53,32 @@ public ProductDetails(HierarchyInformation hierarchyInformation) Argument.AssertNotNull(hierarchyInformation, nameof(hierarchyInformation)); HierarchyInformation = hierarchyInformation; - DeviceDetails = new ChangeTrackingList(); + OptInAdditionalConfigurations = new ChangeTrackingList(); + ChildConfigurationDeviceDetails = new ChangeTrackingList(); } /// Initializes a new instance of . /// Display details of the product. /// Hierarchy of the product which uniquely identifies the product. - /// Quantity of the product. /// Double encryption status of the configuration. Read-only field. - /// list of device details. + /// Identification type of the configuration. + /// Device details of the parent configuration. + /// Device Provisioning Details for Parent. + /// List of additional configurations customer wants in the order item apart from the ones included in the base configuration. + /// Details of all child configurations that are part of the order item. + /// Term Commitment Information of the Device. /// Keeps track of any properties unknown to the library. - internal ProductDetails(ProductDisplayInfo displayInfo, HierarchyInformation hierarchyInformation, int? count, DoubleEncryptionStatus? productDoubleEncryptionStatus, IReadOnlyList deviceDetails, IDictionary serializedAdditionalRawData) + internal ProductDetails(DisplayInfo displayInfo, HierarchyInformation hierarchyInformation, DoubleEncryptionStatus? productDoubleEncryptionStatus, IdentificationType? identificationType, DeviceDetails parentDeviceDetails, ProvisioningDetails parentProvisioningDetails, IList optInAdditionalConfigurations, IReadOnlyList childConfigurationDeviceDetails, TermCommitmentInformation termCommitmentInformation, IDictionary serializedAdditionalRawData) { DisplayInfo = displayInfo; HierarchyInformation = hierarchyInformation; - Count = count; ProductDoubleEncryptionStatus = productDoubleEncryptionStatus; - DeviceDetails = deviceDetails; + IdentificationType = identificationType; + ParentDeviceDetails = parentDeviceDetails; + ParentProvisioningDetails = parentProvisioningDetails; + OptInAdditionalConfigurations = optInAdditionalConfigurations; + ChildConfigurationDeviceDetails = childConfigurationDeviceDetails; + TermCommitmentInformation = termCommitmentInformation; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -79,14 +88,22 @@ internal ProductDetails() } /// Display details of the product. - public ProductDisplayInfo DisplayInfo { get; set; } + public DisplayInfo DisplayInfo { get; set; } /// Hierarchy of the product which uniquely identifies the product. public HierarchyInformation HierarchyInformation { get; set; } - /// Quantity of the product. - public int? Count { get; } /// Double encryption status of the configuration. Read-only field. public DoubleEncryptionStatus? ProductDoubleEncryptionStatus { get; } - /// list of device details. - public IReadOnlyList DeviceDetails { get; } + /// Identification type of the configuration. + public IdentificationType? IdentificationType { get; } + /// Device details of the parent configuration. + public DeviceDetails ParentDeviceDetails { get; } + /// Device Provisioning Details for Parent. + public ProvisioningDetails ParentProvisioningDetails { get; set; } + /// List of additional configurations customer wants in the order item apart from the ones included in the base configuration. + public IList OptInAdditionalConfigurations { get; } + /// Details of all child configurations that are part of the order item. + public IReadOnlyList ChildConfigurationDeviceDetails { get; } + /// Term Commitment Information of the Device. + public TermCommitmentInformation TermCommitmentInformation { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.Serialization.cs new file mode 100644 index 000000000000..3bc0e6070a9d --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + internal partial class ProductDetailsUpdateParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProductDetailsUpdateParameter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ParentProvisioningDetails)) + { + writer.WritePropertyName("parentProvisioningDetails"u8); + writer.WriteObjectValue(ParentProvisioningDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProductDetailsUpdateParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProductDetailsUpdateParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProductDetailsUpdateParameter(document.RootElement, options); + } + + internal static ProductDetailsUpdateParameter DeserializeProductDetailsUpdateParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningDetails parentProvisioningDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parentProvisioningDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parentProvisioningDetails = ProvisioningDetails.DeserializeProvisioningDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProductDetailsUpdateParameter(parentProvisioningDetails, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ProductDetailsUpdateParameter)} does not support writing '{options.Format}' format."); + } + } + + ProductDetailsUpdateParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProductDetailsUpdateParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProductDetailsUpdateParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.cs new file mode 100644 index 000000000000..845d6003bc15 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductDetailsUpdateParameter.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Represents product details patchable properties. + internal partial class ProductDetailsUpdateParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProductDetailsUpdateParameter() + { + } + + /// Initializes a new instance of . + /// Device Provisioning Details for Parent. + /// Keeps track of any properties unknown to the library. + internal ProductDetailsUpdateParameter(ProvisioningDetails parentProvisioningDetails, IDictionary serializedAdditionalRawData) + { + ParentProvisioningDetails = parentProvisioningDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Device Provisioning Details for Parent. + public ProvisioningDetails ParentProvisioningDetails { get; set; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.Serialization.cs index 1ad0129c0c45..1331f031c950 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ProductFamilies)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static ProductFamilies DeserializeProductFamilies(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static ProductFamilies DeserializeProductFamilies(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static ProductFamilies DeserializeProductFamilies(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ProductFamilies(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ProductFamilies(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.cs index 3be6a64c34ad..865202eeda00 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamilies.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { @@ -46,25 +47,31 @@ internal partial class ProductFamilies private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ProductFamilies() + /// The ProductFamily items on this page. + internal ProductFamilies(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of product families. - /// Link for the next set of product families. + /// The ProductFamily items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ProductFamilies(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ProductFamilies(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of product families. + /// Initializes a new instance of for deserialization. + internal ProductFamilies() + { + } + + /// The ProductFamily items on this page. public IReadOnlyList Value { get; } - /// Link for the next set of product families. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.Serialization.cs index a40062130841..ab7b0395431f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductFamiliesMetadata : IUtf8JsonSerializable, IJsonModel + internal partial class ProductFamiliesMetadata : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -34,74 +34,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ProductFamiliesMetadata)} does not support writing '{format}' format."); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteObjectValue(Description, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) - { - writer.WritePropertyName("imageInformation"u8); - writer.WriteStartArray(); - foreach (var item in ImageInformation) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CostInformation)) - { - writer.WritePropertyName("costInformation"u8); - writer.WriteObjectValue(CostInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) - { - writer.WritePropertyName("availabilityInformation"u8); - writer.WriteObjectValue(AvailabilityInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) - { - writer.WritePropertyName("hierarchyInformation"u8); - writer.WriteObjectValue(HierarchyInformation, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) - { - writer.WritePropertyName("filterableProperties"u8); - writer.WriteStartArray(); - foreach (var item in FilterableProperties) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ProductLines)) + if (options.Format != "W") { - writer.WritePropertyName("productLines"u8); + writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in ProductLines) + foreach (var item in Value) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (Optional.IsCollectionDefined(ResourceProviderDetails)) + if (Optional.IsDefined(NextLink)) { - writer.WritePropertyName("resourceProviderDetails"u8); - writer.WriteStartArray(); - foreach (var item in ResourceProviderDetails) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -139,126 +86,29 @@ internal static ProductFamiliesMetadata DeserializeProductFamiliesMetadata(JsonE { return null; } - string displayName = default; - ProductDescription description = default; - IReadOnlyList imageInformation = default; - EdgeOrderProductCostInformation costInformation = default; - ProductAvailabilityInformation availabilityInformation = default; - HierarchyInformation hierarchyInformation = default; - IReadOnlyList filterableProperties = default; - IReadOnlyList productLines = default; - IReadOnlyList resourceProviderDetails = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - property.ThrowNonNullablePropertyIsNull(); - continue; + array.Add(ProductFamiliesMetadataDetails.DeserializeProductFamiliesMetadataDetails(item, options)); } - foreach (var property0 in property.Value.EnumerateObject()) + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - description = ProductDescription.DeserializeProductDescription(property0.Value, options); - continue; - } - if (property0.NameEquals("imageInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EdgeOrderProductImageInformation.DeserializeEdgeOrderProductImageInformation(item, options)); - } - imageInformation = array; - continue; - } - if (property0.NameEquals("costInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - costInformation = EdgeOrderProductCostInformation.DeserializeEdgeOrderProductCostInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("availabilityInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityInformation = ProductAvailabilityInformation.DeserializeProductAvailabilityInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("hierarchyInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("filterableProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); - } - filterableProperties = array; - continue; - } - if (property0.NameEquals("productLines"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ProductLine.DeserializeProductLine(item, options)); - } - productLines = array; - continue; - } - if (property0.NameEquals("resourceProviderDetails"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(Models.ResourceProviderDetails.DeserializeResourceProviderDetails(item, options)); - } - resourceProviderDetails = array; - continue; - } + continue; } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -267,17 +117,7 @@ internal static ProductFamiliesMetadata DeserializeProductFamiliesMetadata(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new ProductFamiliesMetadata( - displayName, - description, - imageInformation ?? new ChangeTrackingList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties ?? new ChangeTrackingList(), - productLines ?? new ChangeTrackingList(), - resourceProviderDetails ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new ProductFamiliesMetadata(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.cs index b78c4f0b5ffc..75820642072a 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadata.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.EdgeOrder.Models { - /// Product families metadata details. - public partial class ProductFamiliesMetadata + /// Holds details about product family metadata. + internal partial class ProductFamiliesMetadata { /// /// Keeps track of any properties unknown to the library. @@ -46,56 +47,31 @@ public partial class ProductFamiliesMetadata private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ProductFamiliesMetadata() + /// The ProductFamiliesMetadataDetails items on this page. + internal ProductFamiliesMetadata(IEnumerable value) { - ImageInformation = new ChangeTrackingList(); - FilterableProperties = new ChangeTrackingList(); - ProductLines = new ChangeTrackingList(); - ResourceProviderDetails = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. - /// List of product lines supported in the product family. - /// Contains details related to resource provider. + /// The ProductFamiliesMetadataDetails items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ProductFamiliesMetadata(string displayName, ProductDescription description, IReadOnlyList imageInformation, EdgeOrderProductCostInformation costInformation, ProductAvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList filterableProperties, IReadOnlyList productLines, IReadOnlyList resourceProviderDetails, IDictionary serializedAdditionalRawData) + internal ProductFamiliesMetadata(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { - DisplayName = displayName; - Description = description; - ImageInformation = imageInformation; - CostInformation = costInformation; - AvailabilityInformation = availabilityInformation; - HierarchyInformation = hierarchyInformation; - FilterableProperties = filterableProperties; - ProductLines = productLines; - ResourceProviderDetails = resourceProviderDetails; + Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Display Name for the product system. - public string DisplayName { get; } - /// Description related to the product system. - public ProductDescription Description { get; } - /// Image information for the product system. - public IReadOnlyList ImageInformation { get; } - /// Cost information for the product system. - public EdgeOrderProductCostInformation CostInformation { get; } - /// Availability information of the product system. - public ProductAvailabilityInformation AvailabilityInformation { get; } - /// Hierarchy information of a product. - public HierarchyInformation HierarchyInformation { get; } - /// list of filters supported for a product. - public IReadOnlyList FilterableProperties { get; } - /// List of product lines supported in the product family. - public IReadOnlyList ProductLines { get; } - /// Contains details related to resource provider. - public IReadOnlyList ResourceProviderDetails { get; } + /// Initializes a new instance of for deserialization. + internal ProductFamiliesMetadata() + { + } + + /// The ProductFamiliesMetadataDetails items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.Serialization.cs new file mode 100644 index 000000000000..fc146327ac6d --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class ProductFamiliesMetadataDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProductFamiliesMetadataDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsCollectionDefined(ProductLines)) + { + writer.WritePropertyName("productLines"u8); + writer.WriteStartArray(); + foreach (var item in ProductLines) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResourceProviderDetails)) + { + writer.WritePropertyName("resourceProviderDetails"u8); + writer.WriteStartArray(); + foreach (var item in ResourceProviderDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProductFamiliesMetadataDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProductFamiliesMetadataDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProductFamiliesMetadataDetails(document.RootElement, options); + } + + internal static ProductFamiliesMetadataDetails DeserializeProductFamiliesMetadataDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList productLines = default; + IReadOnlyList resourceProviderDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("productLines"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ProductLine.DeserializeProductLine(item, options)); + } + productLines = array; + continue; + } + if (property0.NameEquals("resourceProviderDetails"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.ResourceProviderDetails.DeserializeResourceProviderDetails(item, options)); + } + resourceProviderDetails = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProductFamiliesMetadataDetails(productLines ?? new ChangeTrackingList(), resourceProviderDetails ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ProductFamiliesMetadataDetails)} does not support writing '{options.Format}' format."); + } + } + + ProductFamiliesMetadataDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProductFamiliesMetadataDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProductFamiliesMetadataDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.cs new file mode 100644 index 000000000000..1e3def35fada --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamiliesMetadataDetails.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Product families metadata details. + public partial class ProductFamiliesMetadataDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ProductFamiliesMetadataDetails() + { + ProductLines = new ChangeTrackingList(); + ResourceProviderDetails = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of product lines supported in the product family. + /// Contains details related to resource provider. + /// Keeps track of any properties unknown to the library. + internal ProductFamiliesMetadataDetails(IReadOnlyList productLines, IReadOnlyList resourceProviderDetails, IDictionary serializedAdditionalRawData) + { + ProductLines = productLines; + ResourceProviderDetails = resourceProviderDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of product lines supported in the product family. + public IReadOnlyList ProductLines { get; } + /// Contains details related to resource provider. + public IReadOnlyList ResourceProviderDetails { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.Serialization.cs index 4289d9deb47f..3892273fdcea 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.Serialization.cs @@ -36,51 +36,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteObjectValue(Description, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) - { - writer.WritePropertyName("imageInformation"u8); - writer.WriteStartArray(); - foreach (var item in ImageInformation) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CostInformation)) - { - writer.WritePropertyName("costInformation"u8); - writer.WriteObjectValue(CostInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) - { - writer.WritePropertyName("availabilityInformation"u8); - writer.WriteObjectValue(AvailabilityInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) - { - writer.WritePropertyName("hierarchyInformation"u8); - writer.WriteObjectValue(HierarchyInformation, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) - { - writer.WritePropertyName("filterableProperties"u8); - writer.WriteStartArray(); - foreach (var item in FilterableProperties) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } if (options.Format != "W" && Optional.IsCollectionDefined(ProductLines)) { writer.WritePropertyName("productLines"u8); @@ -139,13 +94,6 @@ internal static ProductFamily DeserializeProductFamily(JsonElement element, Mode { return null; } - string displayName = default; - ProductDescription description = default; - IReadOnlyList imageInformation = default; - EdgeOrderProductCostInformation costInformation = default; - ProductAvailabilityInformation availabilityInformation = default; - HierarchyInformation hierarchyInformation = default; - IReadOnlyList filterableProperties = default; IReadOnlyList productLines = default; IReadOnlyList resourceProviderDetails = default; IDictionary serializedAdditionalRawData = default; @@ -161,75 +109,6 @@ internal static ProductFamily DeserializeProductFamily(JsonElement element, Mode } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - description = ProductDescription.DeserializeProductDescription(property0.Value, options); - continue; - } - if (property0.NameEquals("imageInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EdgeOrderProductImageInformation.DeserializeEdgeOrderProductImageInformation(item, options)); - } - imageInformation = array; - continue; - } - if (property0.NameEquals("costInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - costInformation = EdgeOrderProductCostInformation.DeserializeEdgeOrderProductCostInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("availabilityInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityInformation = ProductAvailabilityInformation.DeserializeProductAvailabilityInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("hierarchyInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("filterableProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); - } - filterableProperties = array; - continue; - } if (property0.NameEquals("productLines"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -267,17 +146,7 @@ internal static ProductFamily DeserializeProductFamily(JsonElement element, Mode } } serializedAdditionalRawData = rawDataDictionary; - return new ProductFamily( - displayName, - description, - imageInformation ?? new ChangeTrackingList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties ?? new ChangeTrackingList(), - productLines ?? new ChangeTrackingList(), - resourceProviderDetails ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new ProductFamily(productLines ?? new ChangeTrackingList(), resourceProviderDetails ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.cs index 2438a32be5b5..3182754159ab 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductFamily.cs @@ -48,51 +48,21 @@ public partial class ProductFamily /// Initializes a new instance of . internal ProductFamily() { - ImageInformation = new ChangeTrackingList(); - FilterableProperties = new ChangeTrackingList(); ProductLines = new ChangeTrackingList(); ResourceProviderDetails = new ChangeTrackingList(); } /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. /// List of product lines supported in the product family. /// Contains details related to resource provider. /// Keeps track of any properties unknown to the library. - internal ProductFamily(string displayName, ProductDescription description, IReadOnlyList imageInformation, EdgeOrderProductCostInformation costInformation, ProductAvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList filterableProperties, IReadOnlyList productLines, IReadOnlyList resourceProviderDetails, IDictionary serializedAdditionalRawData) + internal ProductFamily(IReadOnlyList productLines, IReadOnlyList resourceProviderDetails, IDictionary serializedAdditionalRawData) { - DisplayName = displayName; - Description = description; - ImageInformation = imageInformation; - CostInformation = costInformation; - AvailabilityInformation = availabilityInformation; - HierarchyInformation = hierarchyInformation; - FilterableProperties = filterableProperties; ProductLines = productLines; ResourceProviderDetails = resourceProviderDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Display Name for the product system. - public string DisplayName { get; } - /// Description related to the product system. - public ProductDescription Description { get; } - /// Image information for the product system. - public IReadOnlyList ImageInformation { get; } - /// Cost information for the product system. - public EdgeOrderProductCostInformation CostInformation { get; } - /// Availability information of the product system. - public ProductAvailabilityInformation AvailabilityInformation { get; } - /// Hierarchy information of a product. - public HierarchyInformation HierarchyInformation { get; } - /// list of filters supported for a product. - public IReadOnlyList FilterableProperties { get; } /// List of product lines supported in the product family. public IReadOnlyList ProductLines { get; } /// Contains details related to resource provider. diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLengthHeightWidthUnit.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLengthHeightWidthUnit.cs deleted file mode 100644 index d121d00e8b6e..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLengthHeightWidthUnit.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Unit for the dimensions of length, height and width. - public readonly partial struct ProductLengthHeightWidthUnit : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ProductLengthHeightWidthUnit(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string INValue = "IN"; - private const string CMValue = "CM"; - - /// Inch, applicable for West US. - public static ProductLengthHeightWidthUnit IN { get; } = new ProductLengthHeightWidthUnit(INValue); - /// Centimeter. - public static ProductLengthHeightWidthUnit CM { get; } = new ProductLengthHeightWidthUnit(CMValue); - /// Determines if two values are the same. - public static bool operator ==(ProductLengthHeightWidthUnit left, ProductLengthHeightWidthUnit right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductLengthHeightWidthUnit left, ProductLengthHeightWidthUnit right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductLengthHeightWidthUnit(string value) => new ProductLengthHeightWidthUnit(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductLengthHeightWidthUnit other && Equals(other); - /// - public bool Equals(ProductLengthHeightWidthUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.Serialization.cs index 3ca74f228ce6..852f932f3aff 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.Serialization.cs @@ -36,51 +36,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteObjectValue(Description, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ImageInformation)) - { - writer.WritePropertyName("imageInformation"u8); - writer.WriteStartArray(); - foreach (var item in ImageInformation) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CostInformation)) - { - writer.WritePropertyName("costInformation"u8); - writer.WriteObjectValue(CostInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(AvailabilityInformation)) - { - writer.WritePropertyName("availabilityInformation"u8); - writer.WriteObjectValue(AvailabilityInformation, options); - } - if (options.Format != "W" && Optional.IsDefined(HierarchyInformation)) - { - writer.WritePropertyName("hierarchyInformation"u8); - writer.WriteObjectValue(HierarchyInformation, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(FilterableProperties)) - { - writer.WritePropertyName("filterableProperties"u8); - writer.WriteStartArray(); - foreach (var item in FilterableProperties) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } if (options.Format != "W" && Optional.IsCollectionDefined(Products)) { writer.WritePropertyName("products"u8); @@ -129,14 +84,7 @@ internal static ProductLine DeserializeProductLine(JsonElement element, ModelRea { return null; } - string displayName = default; - ProductDescription description = default; - IReadOnlyList imageInformation = default; - EdgeOrderProductCostInformation costInformation = default; - ProductAvailabilityInformation availabilityInformation = default; - HierarchyInformation hierarchyInformation = default; - IReadOnlyList filterableProperties = default; - IReadOnlyList products = default; + IReadOnlyList products = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -150,85 +98,16 @@ internal static ProductLine DeserializeProductLine(JsonElement element, ModelRea } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - description = ProductDescription.DeserializeProductDescription(property0.Value, options); - continue; - } - if (property0.NameEquals("imageInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(EdgeOrderProductImageInformation.DeserializeEdgeOrderProductImageInformation(item, options)); - } - imageInformation = array; - continue; - } - if (property0.NameEquals("costInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - costInformation = EdgeOrderProductCostInformation.DeserializeEdgeOrderProductCostInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("availabilityInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availabilityInformation = ProductAvailabilityInformation.DeserializeProductAvailabilityInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("hierarchyInformation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value, options); - continue; - } - if (property0.NameEquals("filterableProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(FilterableProperty.DeserializeFilterableProperty(item, options)); - } - filterableProperties = array; - continue; - } if (property0.NameEquals("products"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(EdgeOrderProduct.DeserializeEdgeOrderProduct(item, options)); + array.Add(Product.DeserializeProduct(item, options)); } products = array; continue; @@ -242,16 +121,7 @@ internal static ProductLine DeserializeProductLine(JsonElement element, ModelRea } } serializedAdditionalRawData = rawDataDictionary; - return new ProductLine( - displayName, - description, - imageInformation ?? new ChangeTrackingList(), - costInformation, - availabilityInformation, - hierarchyInformation, - filterableProperties ?? new ChangeTrackingList(), - products ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new ProductLine(products ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.cs index d2a7c50e8cc8..8d1a7c6b5ed9 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductLine.cs @@ -48,49 +48,19 @@ public partial class ProductLine /// Initializes a new instance of . internal ProductLine() { - ImageInformation = new ChangeTrackingList(); - FilterableProperties = new ChangeTrackingList(); - Products = new ChangeTrackingList(); + Products = new ChangeTrackingList(); } /// Initializes a new instance of . - /// Display Name for the product system. - /// Description related to the product system. - /// Image information for the product system. - /// Cost information for the product system. - /// Availability information of the product system. - /// Hierarchy information of a product. - /// list of filters supported for a product. /// List of products in the product line. /// Keeps track of any properties unknown to the library. - internal ProductLine(string displayName, ProductDescription description, IReadOnlyList imageInformation, EdgeOrderProductCostInformation costInformation, ProductAvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList filterableProperties, IReadOnlyList products, IDictionary serializedAdditionalRawData) + internal ProductLine(IReadOnlyList products, IDictionary serializedAdditionalRawData) { - DisplayName = displayName; - Description = description; - ImageInformation = imageInformation; - CostInformation = costInformation; - AvailabilityInformation = availabilityInformation; - HierarchyInformation = hierarchyInformation; - FilterableProperties = filterableProperties; Products = products; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Display Name for the product system. - public string DisplayName { get; } - /// Description related to the product system. - public ProductDescription Description { get; } - /// Image information for the product system. - public IReadOnlyList ImageInformation { get; } - /// Cost information for the product system. - public EdgeOrderProductCostInformation CostInformation { get; } - /// Availability information of the product system. - public ProductAvailabilityInformation AvailabilityInformation { get; } - /// Hierarchy information of a product. - public HierarchyInformation HierarchyInformation { get; } - /// list of filters supported for a product. - public IReadOnlyList FilterableProperties { get; } /// List of products in the product line. - public IReadOnlyList Products { get; } + public IReadOnlyList Products { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductWeightMeasurementUnit.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductWeightMeasurementUnit.cs deleted file mode 100644 index c6ba71615fa1..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductWeightMeasurementUnit.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.EdgeOrder.Models -{ - /// Unit for the dimensions of weight. - public readonly partial struct ProductWeightMeasurementUnit : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ProductWeightMeasurementUnit(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string LbsValue = "LBS"; - private const string KgsValue = "KGS"; - - /// Pounds. - public static ProductWeightMeasurementUnit Lbs { get; } = new ProductWeightMeasurementUnit(LbsValue); - /// Kilograms. - public static ProductWeightMeasurementUnit Kgs { get; } = new ProductWeightMeasurementUnit(KgsValue); - /// Determines if two values are the same. - public static bool operator ==(ProductWeightMeasurementUnit left, ProductWeightMeasurementUnit right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProductWeightMeasurementUnit left, ProductWeightMeasurementUnit right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProductWeightMeasurementUnit(string value) => new ProductWeightMeasurementUnit(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProductWeightMeasurementUnit other && Equals(other); - /// - public bool Equals(ProductWeightMeasurementUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.Serialization.cs new file mode 100644 index 000000000000..bcd2bbf093d2 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class ProvisioningDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Quantity)) + { + writer.WritePropertyName("quantity"u8); + writer.WriteNumberValue(Quantity.Value); + } + if (Optional.IsDefined(ProvisioningArmId)) + { + writer.WritePropertyName("provisioningArmId"u8); + writer.WriteStringValue(ProvisioningArmId); + } + if (Optional.IsDefined(ProvisioningEndPoint)) + { + writer.WritePropertyName("provisioningEndPoint"u8); + writer.WriteStringValue(ProvisioningEndPoint); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsDefined(VendorName)) + { + writer.WritePropertyName("vendorName"u8); + writer.WriteStringValue(VendorName); + } + if (Optional.IsDefined(ReadyToConnectArmId)) + { + writer.WritePropertyName("readyToConnectArmId"u8); + writer.WriteStringValue(ReadyToConnectArmId); + } + if (Optional.IsDefined(ManagementResourceArmId)) + { + writer.WritePropertyName("managementResourceArmId"u8); + writer.WriteStringValue(ManagementResourceArmId); + } + if (options.Format != "W" && Optional.IsDefined(UniqueDeviceIdentifier)) + { + writer.WritePropertyName("uniqueDeviceIdentifier"u8); + writer.WriteStringValue(UniqueDeviceIdentifier); + } + if (Optional.IsDefined(AutoProvisioningStatus)) + { + writer.WritePropertyName("autoProvisioningStatus"u8); + writer.WriteStringValue(AutoProvisioningStatus.Value.ToString()); + } + if (Optional.IsDefined(DevicePresenceVerification)) + { + writer.WritePropertyName("devicePresenceVerification"u8); + writer.WriteObjectValue(DevicePresenceVerification, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProvisioningDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisioningDetails(document.RootElement, options); + } + + internal static ProvisioningDetails DeserializeProvisioningDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? quantity = default; + ResourceIdentifier provisioningArmId = default; + string provisioningEndPoint = default; + string serialNumber = default; + string vendorName = default; + ResourceIdentifier readyToConnectArmId = default; + ResourceIdentifier managementResourceArmId = default; + string uniqueDeviceIdentifier = default; + AutoProvisioningStatus? autoProvisioningStatus = default; + DevicePresenceVerificationDetails devicePresenceVerification = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("quantity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quantity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningArmId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningEndPoint"u8)) + { + provisioningEndPoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("vendorName"u8)) + { + vendorName = property.Value.GetString(); + continue; + } + if (property.NameEquals("readyToConnectArmId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readyToConnectArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("managementResourceArmId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managementResourceArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("uniqueDeviceIdentifier"u8)) + { + uniqueDeviceIdentifier = property.Value.GetString(); + continue; + } + if (property.NameEquals("autoProvisioningStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoProvisioningStatus = new AutoProvisioningStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("devicePresenceVerification"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + devicePresenceVerification = DevicePresenceVerificationDetails.DeserializeDevicePresenceVerificationDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisioningDetails( + quantity, + provisioningArmId, + provisioningEndPoint, + serialNumber, + vendorName, + readyToConnectArmId, + managementResourceArmId, + uniqueDeviceIdentifier, + autoProvisioningStatus, + devicePresenceVerification, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(ProvisioningDetails)} does not support writing '{options.Format}' format."); + } + } + + ProvisioningDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProvisioningDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisioningDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.cs new file mode 100644 index 000000000000..f5c84e334c28 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Details Related To Provision Resource. + public partial class ProvisioningDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProvisioningDetails() + { + } + + /// Initializes a new instance of . + /// Quantity of the devices. + /// Provisioning Resource Arm ID. + /// Provisioning End Point. + /// Serial Number for the Device. + /// Vendor Name for the Device , (for 1P devices - Microsoft). + /// Arc Enabled Resource Arm id. + /// Management Resource ArmId. + /// Unique Identity for a Device. + /// Auto Provisioning Details. + /// Proof of possession details. + /// Keeps track of any properties unknown to the library. + internal ProvisioningDetails(int? quantity, ResourceIdentifier provisioningArmId, string provisioningEndPoint, string serialNumber, string vendorName, ResourceIdentifier readyToConnectArmId, ResourceIdentifier managementResourceArmId, string uniqueDeviceIdentifier, AutoProvisioningStatus? autoProvisioningStatus, DevicePresenceVerificationDetails devicePresenceVerification, IDictionary serializedAdditionalRawData) + { + Quantity = quantity; + ProvisioningArmId = provisioningArmId; + ProvisioningEndPoint = provisioningEndPoint; + SerialNumber = serialNumber; + VendorName = vendorName; + ReadyToConnectArmId = readyToConnectArmId; + ManagementResourceArmId = managementResourceArmId; + UniqueDeviceIdentifier = uniqueDeviceIdentifier; + AutoProvisioningStatus = autoProvisioningStatus; + DevicePresenceVerification = devicePresenceVerification; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Quantity of the devices. + public int? Quantity { get; set; } + /// Provisioning Resource Arm ID. + public ResourceIdentifier ProvisioningArmId { get; set; } + /// Provisioning End Point. + public string ProvisioningEndPoint { get; set; } + /// Serial Number for the Device. + public string SerialNumber { get; set; } + /// Vendor Name for the Device , (for 1P devices - Microsoft). + public string VendorName { get; set; } + /// Arc Enabled Resource Arm id. + public ResourceIdentifier ReadyToConnectArmId { get; set; } + /// Management Resource ArmId. + public ResourceIdentifier ManagementResourceArmId { get; set; } + /// Unique Identity for a Device. + public string UniqueDeviceIdentifier { get; } + /// Auto Provisioning Details. + public AutoProvisioningStatus? AutoProvisioningStatus { get; set; } + /// Proof of possession details. + public DevicePresenceVerificationDetails DevicePresenceVerification { get; set; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningState.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..1b4e0aed7f49 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Provisioning state. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Creating state. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// Succeeded state. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Failed state. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled state. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningSupport.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningSupport.cs new file mode 100644 index 000000000000..138667f05e8a --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProvisioningSupport.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Determining nature of provisioning that the configuration supports. + public readonly partial struct ProvisioningSupport : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningSupport(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CloudBasedValue = "CloudBased"; + private const string ManualValue = "Manual"; + + /// The configuration can be provisioned from the cloud. + public static ProvisioningSupport CloudBased { get; } = new ProvisioningSupport(CloudBasedValue); + /// The configuration need to be provisioned manually by the end user. + public static ProvisioningSupport Manual { get; } = new ProvisioningSupport(ManualValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningSupport left, ProvisioningSupport right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningSupport left, ProvisioningSupport right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningSupport(string value) => new ProvisioningSupport(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningSupport other && Equals(other); + /// + public bool Equals(ProvisioningSupport other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.Serialization.cs index 07a185ad134e..2ec9422cb0dc 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.Serialization.cs @@ -77,7 +77,7 @@ internal static PurchaseMeterDetails DeserializePurchaseMeterDetails(JsonElement string termId = default; BillingType billingType = default; double? multiplier = default; - EdgeOrderProductChargingType? chargingType = default; + ChargingType? chargingType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -117,7 +117,7 @@ internal static PurchaseMeterDetails DeserializePurchaseMeterDetails(JsonElement { continue; } - chargingType = new EdgeOrderProductChargingType(property.Value.GetString()); + chargingType = new ChargingType(property.Value.GetString()); continue; } if (options.Format != "W") diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.cs index 19cfc764fcdc..1ff2ed5cb8f5 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/PurchaseMeterDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Billing type Purchase meter details. - public partial class PurchaseMeterDetails : EdgeOrderProductMeterDetails + public partial class PurchaseMeterDetails : MeterDetails { /// Initializes a new instance of . internal PurchaseMeterDetails() @@ -27,7 +27,7 @@ internal PurchaseMeterDetails() /// Product Id. /// Sku Id. /// Term Id. - internal PurchaseMeterDetails(BillingType billingType, double? multiplier, EdgeOrderProductChargingType? chargingType, IDictionary serializedAdditionalRawData, string productId, string skuId, string termId) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) + internal PurchaseMeterDetails(BillingType billingType, double? multiplier, ChargingType? chargingType, IDictionary serializedAdditionalRawData, string productId, string skuId, string termId) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) { ProductId = productId; SkuId = skuId; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.Serialization.cs similarity index 67% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.Serialization.cs index 76ee711cd4f4..392f91d77c16 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemReturnContent : IUtf8JsonSerializable, IJsonModel + public partial class ReturnOrderItemDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemReturnContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ReturnOrderItemDetails)} does not support writing '{format}' format."); } if (Optional.IsDefined(ReturnAddress)) @@ -46,10 +46,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("serviceTag"u8); writer.WriteStringValue(ServiceTag); } - if (Optional.IsDefined(IsShippingBoxRequired)) + if (Optional.IsDefined(ShippingBoxRequired)) { writer.WritePropertyName("shippingBoxRequired"u8); - writer.WriteBooleanValue(IsShippingBoxRequired.Value); + writer.WriteBooleanValue(ShippingBoxRequired.Value); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -68,19 +68,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemReturnContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ReturnOrderItemDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemReturnContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ReturnOrderItemDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemReturnContent(document.RootElement, options); + return DeserializeReturnOrderItemDetails(document.RootElement, options); } - internal static EdgeOrderItemReturnContent DeserializeEdgeOrderItemReturnContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ReturnOrderItemDetails DeserializeReturnOrderItemDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,7 +88,7 @@ internal static EdgeOrderItemReturnContent DeserializeEdgeOrderItemReturnContent { return null; } - EdgeOrderItemAddressProperties returnAddress = default; + AddressProperties returnAddress = default; string returnReason = default; string serviceTag = default; bool? shippingBoxRequired = default; @@ -102,7 +102,7 @@ internal static EdgeOrderItemReturnContent DeserializeEdgeOrderItemReturnContent { continue; } - returnAddress = EdgeOrderItemAddressProperties.DeserializeEdgeOrderItemAddressProperties(property.Value, options); + returnAddress = AddressProperties.DeserializeAddressProperties(property.Value, options); continue; } if (property.NameEquals("returnReason"u8)) @@ -130,38 +130,38 @@ internal static EdgeOrderItemReturnContent DeserializeEdgeOrderItemReturnContent } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemReturnContent(returnAddress, returnReason, serviceTag, shippingBoxRequired, serializedAdditionalRawData); + return new ReturnOrderItemDetails(returnAddress, returnReason, serviceTag, shippingBoxRequired, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemReturnContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ReturnOrderItemDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemReturnContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ReturnOrderItemDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemReturnContent(document.RootElement, options); + return DeserializeReturnOrderItemDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemReturnContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ReturnOrderItemDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.cs similarity index 71% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.cs index 2a3c1a313504..9469aef5a201 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemReturnContent.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReturnOrderItemDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Return order item request body. - public partial class EdgeOrderItemReturnContent + public partial class ReturnOrderItemDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,43 +45,43 @@ public partial class EdgeOrderItemReturnContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Return Reason. /// is null. - public EdgeOrderItemReturnContent(string returnReason) + public ReturnOrderItemDetails(string returnReason) { Argument.AssertNotNull(returnReason, nameof(returnReason)); ReturnReason = returnReason; } - /// Initializes a new instance of . - /// customer return address. + /// Initializes a new instance of . + /// Customer return address. /// Return Reason. /// Service tag (located on the bottom-right corner of the device). - /// Shipping Box required. + /// Shipping Box required. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemReturnContent(EdgeOrderItemAddressProperties returnAddress, string returnReason, string serviceTag, bool? isShippingBoxRequired, IDictionary serializedAdditionalRawData) + internal ReturnOrderItemDetails(AddressProperties returnAddress, string returnReason, string serviceTag, bool? shippingBoxRequired, IDictionary serializedAdditionalRawData) { ReturnAddress = returnAddress; ReturnReason = returnReason; ServiceTag = serviceTag; - IsShippingBoxRequired = isShippingBoxRequired; + ShippingBoxRequired = shippingBoxRequired; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemReturnContent() + /// Initializes a new instance of for deserialization. + internal ReturnOrderItemDetails() { } - /// customer return address. - public EdgeOrderItemAddressProperties ReturnAddress { get; set; } + /// Customer return address. + public AddressProperties ReturnAddress { get; set; } /// Return Reason. public string ReturnReason { get; } /// Service tag (located on the bottom-right corner of the device). public string ServiceTag { get; set; } /// Shipping Box required. - public bool? IsShippingBoxRequired { get; set; } + public bool? ShippingBoxRequired { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.Serialization.cs index e1377a27bae2..66cc97a0d730 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.Serialization.cs @@ -57,7 +57,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(TrackingUri)) { writer.WritePropertyName("trackingUrl"u8); - writer.WriteStringValue(TrackingUri.AbsoluteUri); + writer.WriteStringValue(TrackingUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -100,7 +100,7 @@ internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonEle string carrierName = default; string carrierDisplayName = default; string trackingId = default; - Uri trackingUrl = default; + string trackingUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -127,11 +127,7 @@ internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonEle } if (property.NameEquals("trackingUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - trackingUrl = new Uri(property.Value.GetString()); + trackingUrl = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.cs index 5266a3ab35fc..3ccd1fd5919c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ReverseShippingDetails.cs @@ -57,7 +57,7 @@ internal ReverseShippingDetails() /// TrackingId of the package. /// TrackingUrl of the package. /// Keeps track of any properties unknown to the library. - internal ReverseShippingDetails(string sasKeyForLabel, string carrierName, string carrierDisplayName, string trackingId, Uri trackingUri, IDictionary serializedAdditionalRawData) + internal ReverseShippingDetails(string sasKeyForLabel, string carrierName, string carrierDisplayName, string trackingId, string trackingUri, IDictionary serializedAdditionalRawData) { SasKeyForLabel = sasKeyForLabel; CarrierName = carrierName; @@ -76,6 +76,6 @@ internal ReverseShippingDetails(string sasKeyForLabel, string carrierName, strin /// TrackingId of the package. public string TrackingId { get; } /// TrackingUrl of the package. - public Uri TrackingUri { get; } + public string TrackingUri { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.Serialization.cs similarity index 77% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.Serialization.cs index 84d8b99f3eb0..589c94498635 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderShippingAddress : IUtf8JsonSerializable, IJsonModel + public partial class ShippingAddress : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,14 +28,17 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderShippingAddress)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ShippingAddress)} does not support writing '{format}' format."); } - writer.WritePropertyName("streetAddress1"u8); - writer.WriteStringValue(StreetAddress1); + if (Optional.IsDefined(StreetAddress1)) + { + writer.WritePropertyName("streetAddress1"u8); + writer.WriteStringValue(StreetAddress1); + } if (Optional.IsDefined(StreetAddress2)) { writer.WritePropertyName("streetAddress2"u8); @@ -95,19 +98,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderShippingAddress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ShippingAddress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderShippingAddress)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ShippingAddress)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderShippingAddress(document.RootElement, options); + return DeserializeShippingAddress(document.RootElement, options); } - internal static EdgeOrderShippingAddress DeserializeEdgeOrderShippingAddress(JsonElement element, ModelReaderWriterOptions options = null) + internal static ShippingAddress DeserializeShippingAddress(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -124,7 +127,7 @@ internal static EdgeOrderShippingAddress DeserializeEdgeOrderShippingAddress(Jso string postalCode = default; string zipExtendedCode = default; string companyName = default; - EdgeOrderAddressType? addressType = default; + AddressType? addressType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -180,7 +183,7 @@ internal static EdgeOrderShippingAddress DeserializeEdgeOrderShippingAddress(Jso { continue; } - addressType = new EdgeOrderAddressType(property.Value.GetString()); + addressType = new AddressType(property.Value.GetString()); continue; } if (options.Format != "W") @@ -189,7 +192,7 @@ internal static EdgeOrderShippingAddress DeserializeEdgeOrderShippingAddress(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderShippingAddress( + return new ShippingAddress( streetAddress1, streetAddress2, streetAddress3, @@ -203,35 +206,35 @@ internal static EdgeOrderShippingAddress DeserializeEdgeOrderShippingAddress(Jso serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderShippingAddress)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ShippingAddress)} does not support writing '{options.Format}' format."); } } - EdgeOrderShippingAddress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ShippingAddress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderShippingAddress(document.RootElement, options); + return DeserializeShippingAddress(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderShippingAddress)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ShippingAddress)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.cs similarity index 78% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.cs index 23282d32e685..c287b8841c2a 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderShippingAddress.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ShippingAddress.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Shipping address where customer wishes to receive the device. - public partial class EdgeOrderShippingAddress + public partial class ShippingAddress { /// /// Keeps track of any properties unknown to the library. @@ -45,20 +45,17 @@ public partial class EdgeOrderShippingAddress /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Street Address line 1. + /// Initializes a new instance of . /// Name of the Country. - /// or is null. - public EdgeOrderShippingAddress(string streetAddress1, string country) + /// is null. + public ShippingAddress(string country) { - Argument.AssertNotNull(streetAddress1, nameof(streetAddress1)); Argument.AssertNotNull(country, nameof(country)); - StreetAddress1 = streetAddress1; Country = country; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Street Address line 1. /// Street Address line 2. /// Street Address line 3. @@ -70,7 +67,7 @@ public EdgeOrderShippingAddress(string streetAddress1, string country) /// Name of the company. /// Type of address. /// Keeps track of any properties unknown to the library. - internal EdgeOrderShippingAddress(string streetAddress1, string streetAddress2, string streetAddress3, string city, string stateOrProvince, string country, string postalCode, string zipExtendedCode, string companyName, EdgeOrderAddressType? addressType, IDictionary serializedAdditionalRawData) + internal ShippingAddress(string streetAddress1, string streetAddress2, string streetAddress3, string city, string stateOrProvince, string country, string postalCode, string zipExtendedCode, string companyName, AddressType? addressType, IDictionary serializedAdditionalRawData) { StreetAddress1 = streetAddress1; StreetAddress2 = streetAddress2; @@ -85,8 +82,8 @@ internal EdgeOrderShippingAddress(string streetAddress1, string streetAddress2, _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderShippingAddress() + /// Initializes a new instance of for deserialization. + internal ShippingAddress() { } @@ -109,6 +106,6 @@ internal EdgeOrderShippingAddress() /// Name of the company. public string CompanyName { get; set; } /// Type of address. - public EdgeOrderAddressType? AddressType { get; set; } + public AddressType? AddressType { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.Serialization.cs new file mode 100644 index 000000000000..81384ba8c1fa --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + internal partial class SiteDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("siteId"u8); + writer.WriteStringValue(SiteId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SiteDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSiteDetails(document.RootElement, options); + } + + internal static SiteDetails DeserializeSiteDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string siteId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("siteId"u8)) + { + siteId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SiteDetails(siteId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(SiteDetails)} does not support writing '{options.Format}' format."); + } + } + + SiteDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSiteDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SiteDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.cs new file mode 100644 index 000000000000..5921a414d87b --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/SiteDetails.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Represents Site Related Details. + internal partial class SiteDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique Id, Identifying A Site. + /// is null. + public SiteDetails(string siteId) + { + Argument.AssertNotNull(siteId, nameof(siteId)); + + SiteId = siteId; + } + + /// Initializes a new instance of . + /// Unique Id, Identifying A Site. + /// Keeps track of any properties unknown to the library. + internal SiteDetails(string siteId, IDictionary serializedAdditionalRawData) + { + SiteId = siteId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SiteDetails() + { + } + + /// Unique Id, Identifying A Site. + public string SiteId { get; set; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.Serialization.cs similarity index 67% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.Serialization.cs index 6c8f3c7177dc..a92a5249e26c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class ProductSpecification : IUtf8JsonSerializable, IJsonModel + public partial class Specification : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductSpecification)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Specification)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Name)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProductSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Specification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ProductSpecification)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Specification)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProductSpecification(document.RootElement, options); + return DeserializeSpecification(document.RootElement, options); } - internal static ProductSpecification DeserializeProductSpecification(JsonElement element, ModelReaderWriterOptions options = null) + internal static Specification DeserializeSpecification(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -103,38 +103,38 @@ internal static ProductSpecification DeserializeProductSpecification(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new ProductSpecification(name, value, serializedAdditionalRawData); + return new Specification(name, value, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(ProductSpecification)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Specification)} does not support writing '{options.Format}' format."); } } - ProductSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Specification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProductSpecification(document.RootElement, options); + return DeserializeSpecification(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ProductSpecification)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Specification)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.cs similarity index 82% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.cs index b8013aed62da..721ddfa026d4 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/ProductSpecification.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/Specification.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - /// Specifications of the configurations. - public partial class ProductSpecification + /// Specification of the configurations. + public partial class Specification { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ProductSpecification /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ProductSpecification() + /// Initializes a new instance of . + internal Specification() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Name of the specification. /// Value of the specification. /// Keeps track of any properties unknown to the library. - internal ProductSpecification(string name, string value, IDictionary serializedAdditionalRawData) + internal Specification(string name, string value, IDictionary serializedAdditionalRawData) { Name = name; Value = value; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.Serialization.cs similarity index 70% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.Serialization.cs index 5d114e2be05a..e803345f906c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderStageDetails : IUtf8JsonSerializable, IJsonModel + public partial class StageDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderStageDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(StageDetails)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(StageStatus)) @@ -71,19 +71,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderStageDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + StageDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderStageDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(StageDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderStageDetails(document.RootElement, options); + return DeserializeStageDetails(document.RootElement, options); } - internal static EdgeOrderStageDetails DeserializeEdgeOrderStageDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static StageDetails DeserializeStageDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -91,8 +91,8 @@ internal static EdgeOrderStageDetails DeserializeEdgeOrderStageDetails(JsonEleme { return null; } - EdgeOrderStageStatus? stageStatus = default; - EdgeOrderStageName? stageName = default; + StageStatus? stageStatus = default; + StageName? stageName = default; string displayName = default; DateTimeOffset? startTime = default; IDictionary serializedAdditionalRawData = default; @@ -105,7 +105,7 @@ internal static EdgeOrderStageDetails DeserializeEdgeOrderStageDetails(JsonEleme { continue; } - stageStatus = new EdgeOrderStageStatus(property.Value.GetString()); + stageStatus = new StageStatus(property.Value.GetString()); continue; } if (property.NameEquals("stageName"u8)) @@ -114,7 +114,7 @@ internal static EdgeOrderStageDetails DeserializeEdgeOrderStageDetails(JsonEleme { continue; } - stageName = new EdgeOrderStageName(property.Value.GetString()); + stageName = new StageName(property.Value.GetString()); continue; } if (property.NameEquals("displayName"u8)) @@ -137,38 +137,38 @@ internal static EdgeOrderStageDetails DeserializeEdgeOrderStageDetails(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderStageDetails(stageStatus, stageName, displayName, startTime, serializedAdditionalRawData); + return new StageDetails(stageStatus, stageName, displayName, startTime, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderStageDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(StageDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderStageDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + StageDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderStageDetails(document.RootElement, options); + return DeserializeStageDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderStageDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(StageDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.cs similarity index 81% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.cs index 04ee129514b0..07dc7f1a14a0 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderStageDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Resource stage details. - public partial class EdgeOrderStageDetails + public partial class StageDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class EdgeOrderStageDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal EdgeOrderStageDetails() + /// Initializes a new instance of . + internal StageDetails() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Stage status. /// Stage name. /// Display name of the resource stage. /// Stage start time. /// Keeps track of any properties unknown to the library. - internal EdgeOrderStageDetails(EdgeOrderStageStatus? stageStatus, EdgeOrderStageName? stageName, string displayName, DateTimeOffset? startOn, IDictionary serializedAdditionalRawData) + internal StageDetails(StageStatus? stageStatus, StageName? stageName, string displayName, DateTimeOffset? startOn, IDictionary serializedAdditionalRawData) { StageStatus = stageStatus; StageName = stageName; @@ -66,9 +66,9 @@ internal EdgeOrderStageDetails(EdgeOrderStageStatus? stageStatus, EdgeOrderStage } /// Stage status. - public EdgeOrderStageStatus? StageStatus { get; } + public StageStatus? StageStatus { get; } /// Stage name. - public EdgeOrderStageName? StageName { get; } + public StageName? StageName { get; } /// Display name of the resource stage. public string DisplayName { get; } /// Stage start time. diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageName.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageName.cs new file mode 100644 index 000000000000..ca017da807ca --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageName.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Stage name. + public readonly partial struct StageName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StageName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PlacedValue = "Placed"; + private const string InReviewValue = "InReview"; + private const string ConfirmedValue = "Confirmed"; + private const string ReadyToShipValue = "ReadyToShip"; + private const string ShippedValue = "Shipped"; + private const string DeliveredValue = "Delivered"; + private const string ReadyToSetupValue = "ReadyToSetup"; + private const string InUseValue = "InUse"; + private const string ReturnInitiatedValue = "ReturnInitiated"; + private const string ReturnPickedUpValue = "ReturnPickedUp"; + private const string ReturnedToMicrosoftValue = "ReturnedToMicrosoft"; + private const string ReturnCompletedValue = "ReturnCompleted"; + private const string CancelledValue = "Cancelled"; + + /// Currently in draft mode and can still be cancelled. + public static StageName Placed { get; } = new StageName(PlacedValue); + /// Order is currently in draft mode and can still be cancelled. + public static StageName InReview { get; } = new StageName(InReviewValue); + /// Order is confirmed. + public static StageName Confirmed { get; } = new StageName(ConfirmedValue); + /// Order is ready to ship. + public static StageName ReadyToShip { get; } = new StageName(ReadyToShipValue); + /// Order is in transit to customer. + public static StageName Shipped { get; } = new StageName(ShippedValue); + /// Order is delivered to customer. + public static StageName Delivered { get; } = new StageName(DeliveredValue); + /// Order is ready to get cloud connected. + public static StageName ReadyToSetup { get; } = new StageName(ReadyToSetupValue); + /// Order is in use at customer site. + public static StageName InUse { get; } = new StageName(InUseValue); + /// Return has been initiated by customer. + public static StageName ReturnInitiated { get; } = new StageName(ReturnInitiatedValue); + /// Order is in transit from customer to Microsoft. + public static StageName ReturnPickedUp { get; } = new StageName(ReturnPickedUpValue); + /// Order has been received back to Microsoft. + public static StageName ReturnedToMicrosoft { get; } = new StageName(ReturnedToMicrosoftValue); + /// Return has now completed. + public static StageName ReturnCompleted { get; } = new StageName(ReturnCompletedValue); + /// Order has been cancelled. + public static StageName Cancelled { get; } = new StageName(CancelledValue); + /// Determines if two values are the same. + public static bool operator ==(StageName left, StageName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StageName left, StageName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StageName(string value) => new StageName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StageName other && Equals(other); + /// + public bool Equals(StageName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageStatus.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageStatus.cs new file mode 100644 index 000000000000..a28cdd29ffee --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/StageStatus.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Stage status. + public readonly partial struct StageStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StageStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string InProgressValue = "InProgress"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string CancellingValue = "Cancelling"; + + /// No status available yet. + public static StageStatus None { get; } = new StageStatus(NoneValue); + /// Stage is in progress. + public static StageStatus InProgress { get; } = new StageStatus(InProgressValue); + /// Stage has succeeded. + public static StageStatus Succeeded { get; } = new StageStatus(SucceededValue); + /// Stage has failed. + public static StageStatus Failed { get; } = new StageStatus(FailedValue); + /// Stage has been cancelled. + public static StageStatus Cancelled { get; } = new StageStatus(CancelledValue); + /// Stage is cancelling. + public static StageStatus Cancelling { get; } = new StageStatus(CancellingValue); + /// Determines if two values are the same. + public static bool operator ==(StageStatus left, StageStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StageStatus left, StageStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StageStatus(string value) => new StageStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StageStatus other && Equals(other); + /// + public bool Equals(StageStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.Serialization.cs similarity index 52% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.Serialization.cs index 5d0dbdc0386e..10367b325941 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/EdgeOrderItemAddressProperties.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - public partial class EdgeOrderItemAddressProperties : IUtf8JsonSerializable, IJsonModel + public partial class TermCommitmentInformation : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,23 +28,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemAddressProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(TermCommitmentInformation)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ShippingAddress)) + writer.WritePropertyName("termCommitmentType"u8); + writer.WriteStringValue(TermCommitmentType.ToString()); + if (options.Format != "W" && Optional.IsDefined(TermCommitmentTypeDuration)) { - writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress, options); + writer.WritePropertyName("termCommitmentTypeDuration"u8); + writer.WriteStringValue(TermCommitmentTypeDuration.Value, "P"); } - writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails, options); - if (options.Format != "W" && Optional.IsDefined(AddressValidationStatus)) + if (options.Format != "W" && Optional.IsDefined(PendingDaysForTerm)) { - writer.WritePropertyName("addressValidationStatus"u8); - writer.WriteStringValue(AddressValidationStatus.Value.ToString()); + writer.WritePropertyName("pendingDaysForTerm"u8); + writer.WriteNumberValue(PendingDaysForTerm.Value); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - EdgeOrderItemAddressProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + TermCommitmentInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemAddressProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(TermCommitmentInformation)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemAddressProperties(document.RootElement, options); + return DeserializeTermCommitmentInformation(document.RootElement, options); } - internal static EdgeOrderItemAddressProperties DeserializeEdgeOrderItemAddressProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static TermCommitmentInformation DeserializeTermCommitmentInformation(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,34 +83,34 @@ internal static EdgeOrderItemAddressProperties DeserializeEdgeOrderItemAddressPr { return null; } - EdgeOrderShippingAddress shippingAddress = default; - EdgeOrderAddressContactDetails contactDetails = default; - EdgeOrderAddressValidationStatus? addressValidationStatus = default; + TermCommitmentType termCommitmentType = default; + TimeSpan? termCommitmentTypeDuration = default; + int? pendingDaysForTerm = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("shippingAddress"u8)) + if (property.NameEquals("termCommitmentType"u8)) + { + termCommitmentType = new TermCommitmentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("termCommitmentTypeDuration"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - shippingAddress = EdgeOrderShippingAddress.DeserializeEdgeOrderShippingAddress(property.Value, options); - continue; - } - if (property.NameEquals("contactDetails"u8)) - { - contactDetails = EdgeOrderAddressContactDetails.DeserializeEdgeOrderAddressContactDetails(property.Value, options); + termCommitmentTypeDuration = property.Value.GetTimeSpan("P"); continue; } - if (property.NameEquals("addressValidationStatus"u8)) + if (property.NameEquals("pendingDaysForTerm"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - addressValidationStatus = new EdgeOrderAddressValidationStatus(property.Value.GetString()); + pendingDaysForTerm = property.Value.GetInt32(); continue; } if (options.Format != "W") @@ -119,38 +119,38 @@ internal static EdgeOrderItemAddressProperties DeserializeEdgeOrderItemAddressPr } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemAddressProperties(shippingAddress, contactDetails, addressValidationStatus, serializedAdditionalRawData); + return new TermCommitmentInformation(termCommitmentType, termCommitmentTypeDuration, pendingDaysForTerm, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemAddressProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(TermCommitmentInformation)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemAddressProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + TermCommitmentInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemAddressProperties(document.RootElement, options); + return DeserializeTermCommitmentInformation(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemAddressProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(TermCommitmentInformation)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.cs new file mode 100644 index 000000000000..9a6c096af664 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentInformation.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Term Commitment Information. + public partial class TermCommitmentInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Term Commitment Type. + internal TermCommitmentInformation(TermCommitmentType termCommitmentType) + { + TermCommitmentType = termCommitmentType; + } + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Term Commitment Duration. Currently Supporting P365D, P1095D. + /// Number of Days Pending for Term Commitment. + /// Keeps track of any properties unknown to the library. + internal TermCommitmentInformation(TermCommitmentType termCommitmentType, TimeSpan? termCommitmentTypeDuration, int? pendingDaysForTerm, IDictionary serializedAdditionalRawData) + { + TermCommitmentType = termCommitmentType; + TermCommitmentTypeDuration = termCommitmentTypeDuration; + PendingDaysForTerm = pendingDaysForTerm; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TermCommitmentInformation() + { + } + + /// Term Commitment Type. + public TermCommitmentType TermCommitmentType { get; } + /// Term Commitment Duration. Currently Supporting P365D, P1095D. + public TimeSpan? TermCommitmentTypeDuration { get; } + /// Number of Days Pending for Term Commitment. + public int? PendingDaysForTerm { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.Serialization.cs new file mode 100644 index 000000000000..f9f2a1899c98 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class TermCommitmentPreferences : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TermCommitmentPreferences)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("preferredTermCommitmentType"u8); + writer.WriteStringValue(PreferredTermCommitmentType.ToString()); + if (Optional.IsDefined(PreferredTermCommitmentDuration)) + { + writer.WritePropertyName("preferredTermCommitmentDuration"u8); + writer.WriteStringValue(PreferredTermCommitmentDuration.Value, "P"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TermCommitmentPreferences IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TermCommitmentPreferences)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTermCommitmentPreferences(document.RootElement, options); + } + + internal static TermCommitmentPreferences DeserializeTermCommitmentPreferences(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TermCommitmentType preferredTermCommitmentType = default; + TimeSpan? preferredTermCommitmentDuration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("preferredTermCommitmentType"u8)) + { + preferredTermCommitmentType = new TermCommitmentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("preferredTermCommitmentDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preferredTermCommitmentDuration = property.Value.GetTimeSpan("P"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TermCommitmentPreferences(preferredTermCommitmentType, preferredTermCommitmentDuration, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(TermCommitmentPreferences)} does not support writing '{options.Format}' format."); + } + } + + TermCommitmentPreferences IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTermCommitmentPreferences(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TermCommitmentPreferences)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.cs new file mode 100644 index 000000000000..ca1f4f0ca154 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentPreferences.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Term Commitment preference received from customer. + public partial class TermCommitmentPreferences + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Term Commitment Type. + public TermCommitmentPreferences(TermCommitmentType preferredTermCommitmentType) + { + PreferredTermCommitmentType = preferredTermCommitmentType; + } + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Customer preferred Term Duration. + /// Keeps track of any properties unknown to the library. + internal TermCommitmentPreferences(TermCommitmentType preferredTermCommitmentType, TimeSpan? preferredTermCommitmentDuration, IDictionary serializedAdditionalRawData) + { + PreferredTermCommitmentType = preferredTermCommitmentType; + PreferredTermCommitmentDuration = preferredTermCommitmentDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TermCommitmentPreferences() + { + } + + /// Term Commitment Type. + public TermCommitmentType PreferredTermCommitmentType { get; set; } + /// Customer preferred Term Duration. + public TimeSpan? PreferredTermCommitmentDuration { get; set; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentType.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentType.cs new file mode 100644 index 000000000000..4fec635dc9be --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermCommitmentType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Term Commitment Type. + public readonly partial struct TermCommitmentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TermCommitmentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string TrialValue = "Trial"; + private const string TimedValue = "Timed"; + + /// Pay as you go Term Commitment Model. + public static TermCommitmentType None { get; } = new TermCommitmentType(NoneValue); + /// Trial Term Commitment Model. + public static TermCommitmentType Trial { get; } = new TermCommitmentType(TrialValue); + /// Time based Term Commitment Model. + public static TermCommitmentType Timed { get; } = new TermCommitmentType(TimedValue); + /// Determines if two values are the same. + public static bool operator ==(TermCommitmentType left, TermCommitmentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TermCommitmentType left, TermCommitmentType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TermCommitmentType(string value) => new TermCommitmentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TermCommitmentType other && Equals(other); + /// + public bool Equals(TermCommitmentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.Serialization.cs new file mode 100644 index 000000000000..e8996879f61a --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + public partial class TermTypeDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TermTypeDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("termType"u8); + writer.WriteStringValue(TermType.ToString()); + writer.WritePropertyName("termTypeDuration"u8); + writer.WriteStringValue(TermTypeDuration, "P"); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TermTypeDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TermTypeDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTermTypeDetails(document.RootElement, options); + } + + internal static TermTypeDetails DeserializeTermTypeDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TermCommitmentType termType = default; + TimeSpan termTypeDuration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("termType"u8)) + { + termType = new TermCommitmentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("termTypeDuration"u8)) + { + termTypeDuration = property.Value.GetTimeSpan("P"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TermTypeDetails(termType, termTypeDuration, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); + default: + throw new FormatException($"The model {nameof(TermTypeDetails)} does not support writing '{options.Format}' format."); + } + } + + TermTypeDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTermTypeDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TermTypeDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.cs new file mode 100644 index 000000000000..e04b26ecf7ff --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/TermTypeDetails.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Holds details about term type and duration. + public partial class TermTypeDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Duration for the term type. + internal TermTypeDetails(TermCommitmentType termType, TimeSpan termTypeDuration) + { + TermType = termType; + TermTypeDuration = termTypeDuration; + } + + /// Initializes a new instance of . + /// Term Commitment Type. + /// Duration for the term type. + /// Keeps track of any properties unknown to the library. + internal TermTypeDetails(TermCommitmentType termType, TimeSpan termTypeDuration, IDictionary serializedAdditionalRawData) + { + TermType = termType; + TermTypeDuration = termTypeDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TermTypeDetails() + { + } + + /// Term Commitment Type. + public TermCommitmentType TermType { get; } + /// Duration for the term type. + public TimeSpan TermTypeDuration { get; } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.Serialization.cs index 0b22215a95b6..198b1ce73207 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.EdgeOrder.Models { - internal partial class UnknownMeterDetails : IUtf8JsonSerializable, IJsonModel + internal partial class UnknownMeterDetails : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,25 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - EdgeOrderProductMeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MeterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderProductMeterDetails(document.RootElement, options); + return DeserializeMeterDetails(document.RootElement, options); } internal static UnknownMeterDetails DeserializeUnknownMeterDetails(JsonElement element, ModelReaderWriterOptions options = null) @@ -59,7 +59,7 @@ internal static UnknownMeterDetails DeserializeUnknownMeterDetails(JsonElement e } BillingType billingType = "Unknown"; double? multiplier = default; - EdgeOrderProductChargingType? chargingType = default; + ChargingType? chargingType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -84,7 +84,7 @@ internal static UnknownMeterDetails DeserializeUnknownMeterDetails(JsonElement e { continue; } - chargingType = new EdgeOrderProductChargingType(property.Value.GetString()); + chargingType = new ChargingType(property.Value.GetString()); continue; } if (options.Format != "W") @@ -96,35 +96,35 @@ internal static UnknownMeterDetails DeserializeUnknownMeterDetails(JsonElement e return new UnknownMeterDetails(billingType, multiplier, chargingType, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support writing '{options.Format}' format."); } } - EdgeOrderProductMeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MeterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderProductMeterDetails(document.RootElement, options); + return DeserializeMeterDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderProductMeterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MeterDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.cs index 95770966dd70..69ec62f4e287 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/UnknownMeterDetails.cs @@ -11,14 +11,14 @@ namespace Azure.ResourceManager.EdgeOrder.Models { /// Unknown version of MeterDetails. - internal partial class UnknownMeterDetails : EdgeOrderProductMeterDetails + internal partial class UnknownMeterDetails : MeterDetails { /// Initializes a new instance of . /// Represents billing type. /// Billing unit applicable for Pav2 billing. /// Charging type. /// Keeps track of any properties unknown to the library. - internal UnknownMeterDetails(BillingType billingType, double? multiplier, EdgeOrderProductChargingType? chargingType, IDictionary serializedAdditionalRawData) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) + internal UnknownMeterDetails(BillingType billingType, double? multiplier, ChargingType? chargingType, IDictionary serializedAdditionalRawData) : base(billingType, multiplier, chargingType, serializedAdditionalRawData) { BillingType = billingType; } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/WeightMeasurementUnit.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/WeightMeasurementUnit.cs new file mode 100644 index 000000000000..b6d5b5640a94 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Models/WeightMeasurementUnit.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.EdgeOrder.Models +{ + /// Unit for the dimensions of weight. + public readonly partial struct WeightMeasurementUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WeightMeasurementUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LBSValue = "LBS"; + private const string KGSValue = "KGS"; + + /// Pounds. + public static WeightMeasurementUnit LBS { get; } = new WeightMeasurementUnit(LBSValue); + /// Kilograms. + public static WeightMeasurementUnit KGS { get; } = new WeightMeasurementUnit(KGSValue); + /// Determines if two values are the same. + public static bool operator ==(WeightMeasurementUnit left, WeightMeasurementUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WeightMeasurementUnit left, WeightMeasurementUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator WeightMeasurementUnit(string value) => new WeightMeasurementUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WeightMeasurementUnit other && Equals(other); + /// + public bool Equals(WeightMeasurementUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.Serialization.cs new file mode 100644 index 000000000000..0b322029abcc --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.EdgeOrder +{ + public partial class OrderItemResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + OrderItemResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); + + OrderItemResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.cs similarity index 66% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.cs index b4cb81f18627..4a96afd91226 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A Class representing an EdgeOrderItem along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetEdgeOrderItemResource method. - /// Otherwise you can get one from its parent resource using the GetEdgeOrderItem method. + /// A Class representing an OrderItemResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetOrderItemResource method. + /// Otherwise you can get one from its parent resource using the GetOrderItemResource method. /// - public partial class EdgeOrderItemResource : ArmResource + public partial class OrderItemResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The orderItemName. @@ -35,35 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _edgeOrderItemClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderItemRestClient; - private readonly EdgeOrderItemData _data; + private readonly ClientDiagnostics _orderItemResourceClientDiagnostics; + private readonly OrderItemResourcesRestOperations _orderItemResourceRestClient; + private readonly OrderItemResourceData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.EdgeOrder/orderItems"; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderItemResource() + /// Initializes a new instance of the class for mocking. + protected OrderItemResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal EdgeOrderItemResource(ArmClient client, EdgeOrderItemData data) : this(client, data.Id) + internal OrderItemResource(ArmClient client, OrderItemResourceData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal EdgeOrderItemResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OrderItemResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string edgeOrderItemApiVersion); - _edgeOrderItemRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderItemApiVersion); + _orderItemResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string orderItemResourceApiVersion); + _orderItemResourceRestClient = new OrderItemResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, orderItemResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -74,7 +74,7 @@ internal EdgeOrderItemResource(ArmClient client, ResourceIdentifier id) : base(c /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual EdgeOrderItemData Data + public virtual OrderItemResourceData Data { get { @@ -91,7 +91,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets an order item. + /// Get an order item. /// /// /// Request Path @@ -99,30 +99,30 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Get"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Get"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); + var response = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -132,7 +132,7 @@ public virtual async Task> GetAsync(string expan } /// - /// Gets an order item. + /// Get an order item. /// /// /// Request Path @@ -140,30 +140,30 @@ public virtual async Task> GetAsync(string expan /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Get"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Get"); scope.Start(); try { - var response = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); + var response = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,7 +173,7 @@ public virtual Response Get(string expand = null, Cancell } /// - /// Deletes an order item. + /// Delete an order item. /// /// /// Request Path @@ -181,15 +181,15 @@ public virtual Response Get(string expand = null, Cancell /// /// /// Operation Id - /// DeleteOrderItemByName + /// OrderItemResource_Delete /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -197,12 +197,12 @@ public virtual Response Get(string expand = null, Cancell /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Delete"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Delete"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.DeleteOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(_edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateDeleteOrderItemByNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _orderItemResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(_orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -215,7 +215,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes an order item. + /// Delete an order item. /// /// /// Request Path @@ -223,15 +223,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// DeleteOrderItemByName + /// OrderItemResource_Delete /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -239,12 +239,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Delete"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Delete"); scope.Start(); try { - var response = _edgeOrderItemRestClient.DeleteOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new EdgeOrderArmOperation(_edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateDeleteOrderItemByNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _orderItemResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new EdgeOrderArmOperation(_orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -257,7 +257,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Updates the properties of an existing order item. + /// Update the properties of an existing order item. /// /// /// Request Path @@ -265,33 +265,33 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// UpdateOrderItem + /// OrderItemResource_Update /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// order item update parameters from request body. + /// Order item update parameters from request body. /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, EdgeOrderItemPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, OrderItemResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Update"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Update"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.UpdateOrderItemAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(new EdgeOrderItemOperationSource(Client), _edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateUpdateOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _orderItemResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(new OrderItemResourceOperationSource(Client), _orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -304,7 +304,7 @@ public virtual async Task> UpdateAsync(WaitU } /// - /// Updates the properties of an existing order item. + /// Update the properties of an existing order item. /// /// /// Request Path @@ -312,33 +312,33 @@ public virtual async Task> UpdateAsync(WaitU /// /// /// Operation Id - /// UpdateOrderItem + /// OrderItemResource_Update /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// order item update parameters from request body. + /// Order item update parameters from request body. /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, EdgeOrderItemPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, OrderItemResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Update"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Update"); scope.Start(); try { - var response = _edgeOrderItemRestClient.UpdateOrderItem(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); - var operation = new EdgeOrderArmOperation(new EdgeOrderItemOperationSource(Client), _edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateUpdateOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _orderItemResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new EdgeOrderArmOperation(new OrderItemResourceOperationSource(Client), _orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -359,30 +359,30 @@ public virtual ArmOperation Update(WaitUntil waitUntil, E /// /// /// Operation Id - /// CancelOrderItem + /// OrderItemResources_Cancel /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Reason for cancellation. /// The cancellation token to use. /// is null. - public virtual async Task CancelAsync(EdgeOrderItemCancellationReason cancellationReason, CancellationToken cancellationToken = default) + public virtual async Task CancelAsync(CancellationReason cancellationReason, CancellationToken cancellationToken = default) { Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Cancel"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Cancel"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.CancelOrderItemAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationReason, cancellationToken).ConfigureAwait(false); + var response = await _orderItemResourceRestClient.CancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationReason, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -401,30 +401,30 @@ public virtual async Task CancelAsync(EdgeOrderItemCancellationReason /// /// /// Operation Id - /// CancelOrderItem + /// OrderItemResources_Cancel /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// Reason for cancellation. /// The cancellation token to use. /// is null. - public virtual Response Cancel(EdgeOrderItemCancellationReason cancellationReason, CancellationToken cancellationToken = default) + public virtual Response Cancel(CancellationReason cancellationReason, CancellationToken cancellationToken = default) { Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Cancel"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.Cancel"); scope.Start(); try { - var response = _edgeOrderItemRestClient.CancelOrderItem(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationReason, cancellationToken); + var response = _orderItemResourceRestClient.Cancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationReason, cancellationToken); return response; } catch (Exception e) @@ -443,34 +443,34 @@ public virtual Response Cancel(EdgeOrderItemCancellationReason cancellationReaso /// /// /// Operation Id - /// ReturnOrderItem + /// OrderItemResources_ReturnOrderItem /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Return order item CurrentStatus. + /// Return order item details. /// The cancellation token to use. - /// is null. - public virtual async Task ReturnAsync(WaitUntil waitUntil, EdgeOrderItemReturnContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> ReturnOrderItemAsync(WaitUntil waitUntil, ReturnOrderItemDetails details, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(details, nameof(details)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Return"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.ReturnOrderItem"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.ReturnOrderItemAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(_edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateReturnOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _orderItemResourceRestClient.ReturnOrderItemAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, details, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(new OkResponseOperationSource(), _orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateReturnOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, details).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -489,34 +489,34 @@ public virtual async Task ReturnAsync(WaitUntil waitUntil, EdgeOrd /// /// /// Operation Id - /// ReturnOrderItem + /// OrderItemResources_ReturnOrderItem /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Return order item CurrentStatus. + /// Return order item details. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Return(WaitUntil waitUntil, EdgeOrderItemReturnContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation ReturnOrderItem(WaitUntil waitUntil, ReturnOrderItemDetails details, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(details, nameof(details)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.Return"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.ReturnOrderItem"); scope.Start(); try { - var response = _edgeOrderItemRestClient.ReturnOrderItem(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new EdgeOrderArmOperation(_edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateReturnOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _orderItemResourceRestClient.ReturnOrderItem(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, details, cancellationToken); + var operation = new EdgeOrderArmOperation(new OkResponseOperationSource(), _orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateReturnOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, details).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -535,15 +535,15 @@ public virtual ArmOperation Return(WaitUntil waitUntil, EdgeOrderItemReturnConte /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -551,12 +551,12 @@ public virtual ArmOperation Return(WaitUntil waitUntil, EdgeOrderItemReturnConte /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.AddTag"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.AddTag"); scope.Start(); try { @@ -565,13 +565,13 @@ public virtual async Task> AddTagAsync(string ke var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderItemPatch(); + var patch = new OrderItemResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -597,15 +597,15 @@ public virtual async Task> AddTagAsync(string ke /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -613,12 +613,12 @@ public virtual async Task> AddTagAsync(string ke /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.AddTag"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.AddTag"); scope.Start(); try { @@ -627,13 +627,13 @@ public virtual Response AddTag(string key, string value, var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new EdgeOrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); + return Response.FromValue(new OrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new EdgeOrderItemPatch(); + var patch = new OrderItemResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -659,26 +659,26 @@ public virtual Response AddTag(string key, string value, /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.SetTags"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.SetTags"); scope.Start(); try { @@ -688,13 +688,13 @@ public virtual async Task> SetTagsAsync(IDiction var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderItemPatch(); + var patch = new OrderItemResourcePatch(); patch.Tags.ReplaceWith(tags); var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -716,26 +716,26 @@ public virtual async Task> SetTagsAsync(IDiction /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.SetTags"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.SetTags"); scope.Start(); try { @@ -745,13 +745,13 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.RemoveTag"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.RemoveTag"); scope.Start(); try { @@ -801,13 +801,13 @@ public virtual async Task> RemoveTagAsync(string var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new EdgeOrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new EdgeOrderItemPatch(); + var patch = new OrderItemResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -833,26 +833,26 @@ public virtual async Task> RemoveTagAsync(string /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemResource.RemoveTag"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResource.RemoveTag"); scope.Start(); try { @@ -861,13 +861,13 @@ public virtual Response RemoveTag(string key, Cancellatio var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new EdgeOrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); + return Response.FromValue(new OrderItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new EdgeOrderItemPatch(); + var patch = new OrderItemResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceCollection.cs similarity index 52% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceCollection.cs index cbb8e3f147bc..27505d88de7c 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetEdgeOrderItems method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetOrderItemResources method from an instance of . /// - public partial class EdgeOrderItemCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class OrderItemResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _edgeOrderItemClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderItemRestClient; + private readonly ClientDiagnostics _orderItemResourceClientDiagnostics; + private readonly OrderItemResourcesRestOperations _orderItemResourceRestClient; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderItemCollection() + /// Initializes a new instance of the class for mocking. + protected OrderItemResourceCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal EdgeOrderItemCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OrderItemResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderItemResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(EdgeOrderItemResource.ResourceType, out string edgeOrderItemApiVersion); - _edgeOrderItemRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderItemApiVersion); + _orderItemResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", OrderItemResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(OrderItemResource.ResourceType, out string orderItemResourceApiVersion); + _orderItemResourceRestClient = new OrderItemResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, orderItemResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -53,7 +53,8 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Creates an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item API. + /// Create an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item + /// API. /// /// /// Request Path @@ -61,15 +62,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// CreateOrderItem + /// OrderItemResource_Create /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -79,19 +80,19 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string orderItemName, EdgeOrderItemData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string orderItemName, OrderItemResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.CreateOrUpdate"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.CreateOrderItemAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data, cancellationToken).ConfigureAwait(false); - var operation = new EdgeOrderArmOperation(new EdgeOrderItemOperationSource(Client), _edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateCreateOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data).Request, response, OperationFinalStateVia.Location); + var response = await _orderItemResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data, cancellationToken).ConfigureAwait(false); + var operation = new EdgeOrderArmOperation(_orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -102,7 +103,8 @@ public virtual async Task> CreateOrUpdateAsy } /// - /// Creates an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item API. + /// Create an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item + /// API. /// /// /// Request Path @@ -110,15 +112,15 @@ public virtual async Task> CreateOrUpdateAsy /// /// /// Operation Id - /// CreateOrderItem + /// OrderItemResource_Create /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// @@ -128,19 +130,19 @@ public virtual async Task> CreateOrUpdateAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string orderItemName, EdgeOrderItemData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string orderItemName, OrderItemResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.CreateOrUpdate"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _edgeOrderItemRestClient.CreateOrderItem(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data, cancellationToken); - var operation = new EdgeOrderArmOperation(new EdgeOrderItemOperationSource(Client), _edgeOrderItemClientDiagnostics, Pipeline, _edgeOrderItemRestClient.CreateCreateOrderItemRequest(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data).Request, response, OperationFinalStateVia.Location); + var response = _orderItemResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data, cancellationToken); + var operation = new EdgeOrderArmOperation(_orderItemResourceClientDiagnostics, Pipeline, _orderItemResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -151,7 +153,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait } /// - /// Gets an order item. + /// Get an order item. /// /// /// Request Path @@ -159,35 +161,35 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.Get"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.Get"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken).ConfigureAwait(false); + var response = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -197,7 +199,7 @@ public virtual async Task> GetAsync(string order } /// - /// Gets an order item. + /// Get an order item. /// /// /// Request Path @@ -205,35 +207,35 @@ public virtual async Task> GetAsync(string order /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.Get"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.Get"); scope.Start(); try { - var response = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken); + var response = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -243,7 +245,7 @@ public virtual Response Get(string orderItemName, string } /// - /// Lists order item at resource group level. + /// List order items at resource group level. /// /// /// Request Path @@ -251,32 +253,33 @@ public virtual Response Get(string orderItemName, string /// /// /// Operation Id - /// ListOrderItemsAtResourceGroupLevel + /// OrderItemResource_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _edgeOrderItemRestClient.CreateListOrderItemsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _edgeOrderItemRestClient.CreateListOrderItemsAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), _edgeOrderItemClientDiagnostics, Pipeline, "EdgeOrderItemCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _orderItemResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _orderItemResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrderItemResource(Client, OrderItemResourceData.DeserializeOrderItemResourceData(e)), _orderItemResourceClientDiagnostics, Pipeline, "OrderItemResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// - /// Lists order item at resource group level. + /// List order items at resource group level. /// /// /// Request Path @@ -284,28 +287,29 @@ public virtual AsyncPageable GetAllAsync(string filter = /// /// /// Operation Id - /// ListOrderItemsAtResourceGroupLevel + /// OrderItemResource_ListByResourceGroup /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _edgeOrderItemRestClient.CreateListOrderItemsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _edgeOrderItemRestClient.CreateListOrderItemsAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), _edgeOrderItemClientDiagnostics, Pipeline, "EdgeOrderItemCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _orderItemResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _orderItemResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand, skipToken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrderItemResource(Client, OrderItemResourceData.DeserializeOrderItemResourceData(e)), _orderItemResourceClientDiagnostics, Pipeline, "OrderItemResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -317,20 +321,20 @@ public virtual Pageable GetAll(string filter = null, stri /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -338,11 +342,11 @@ public virtual async Task> ExistsAsync(string orderItemName, stri { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.Exists"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.Exists"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -361,20 +365,20 @@ public virtual async Task> ExistsAsync(string orderItemName, stri /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -382,11 +386,11 @@ public virtual Response Exists(string orderItemName, string expand = null, { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.Exists"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.Exists"); scope.Start(); try { - var response = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken); + var response = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,35 +409,35 @@ public virtual Response Exists(string orderItemName, string expand = null, /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.GetIfExists"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.GetIfExists"); scope.Start(); try { - var response = await _edgeOrderItemRestClient.GetOrderItemByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _orderItemResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -451,35 +455,35 @@ public virtual async Task> GetIfExistsAs /// /// /// Operation Id - /// GetOrderItemByName + /// OrderItemResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string orderItemName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - using var scope = _edgeOrderItemClientDiagnostics.CreateScope("EdgeOrderItemCollection.GetIfExists"); + using var scope = _orderItemResourceClientDiagnostics.CreateScope("OrderItemResourceCollection.GetIfExists"); scope.Start(); try { - var response = _edgeOrderItemRestClient.GetOrderItemByName(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken); + var response = _orderItemResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, orderItemName, expand, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderItemResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrderItemResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -488,7 +492,7 @@ public virtual NullableResponse GetIfExists(string orderI } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -498,7 +502,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.Serialization.cs similarity index 63% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.Serialization.cs index 0f41a9fbd72d..d475541ae5b5 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.EdgeOrder { - public partial class EdgeOrderItemData : IUtf8JsonSerializable, IJsonModel + public partial class OrderItemResourceData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,19 +30,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourceData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("orderItemDetails"u8); writer.WriteObjectValue(OrderItemDetails, options); - writer.WritePropertyName("addressDetails"u8); - writer.WriteObjectValue(AddressDetails, options); + if (Optional.IsDefined(AddressDetails)) + { + writer.WritePropertyName("addressDetails"u8); + writer.WriteObjectValue(AddressDetails, options); + } if (options.Format != "W" && Optional.IsDefined(StartOn)) { writer.WritePropertyName("startTime"u8); @@ -50,22 +58,27 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WritePropertyName("orderId"u8); writer.WriteStringValue(OrderId); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } writer.WriteEndObject(); } - EdgeOrderItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OrderItemResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderItemData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourceData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderItemData(document.RootElement, options); + return DeserializeOrderItemResourceData(document.RootElement, options); } - internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement element, ModelReaderWriterOptions options = null) + internal static OrderItemResourceData DeserializeOrderItemResourceData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -73,20 +86,31 @@ internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement eleme { return null; } + ManagedServiceIdentity identity = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - EdgeOrderItemDetails orderItemDetails = default; - EdgeOrderItemAddressDetails addressDetails = default; + OrderItemDetails orderItemDetails = default; + AddressDetails addressDetails = default; DateTimeOffset? startTime = default; - ResourceIdentifier orderId = default; + string orderId = default; + ProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -141,12 +165,16 @@ internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement eleme { if (property0.NameEquals("orderItemDetails"u8)) { - orderItemDetails = EdgeOrderItemDetails.DeserializeEdgeOrderItemDetails(property0.Value, options); + orderItemDetails = OrderItemDetails.DeserializeOrderItemDetails(property0.Value, options); continue; } if (property0.NameEquals("addressDetails"u8)) { - addressDetails = EdgeOrderItemAddressDetails.DeserializeEdgeOrderItemAddressDetails(property0.Value, options); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addressDetails = AddressDetails.DeserializeAddressDetails(property0.Value, options); continue; } if (property0.NameEquals("startTime"u8)) @@ -160,7 +188,16 @@ internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement eleme } if (property0.NameEquals("orderId"u8)) { - orderId = new ResourceIdentifier(property0.Value.GetString()); + orderId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } @@ -172,7 +209,7 @@ internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderItemData( + return new OrderItemResourceData( id, name, type, @@ -183,38 +220,40 @@ internal static EdgeOrderItemData DeserializeEdgeOrderItemData(JsonElement eleme addressDetails, startTime, orderId, + provisioningState, + identity, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderItemData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourceData)} does not support writing '{options.Format}' format."); } } - EdgeOrderItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OrderItemResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderItemData(document.RootElement, options); + return DeserializeOrderItemResourceData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderItemData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderItemResourceData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.cs similarity index 66% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.cs index 8b3caeed525e..b5fbd8ad0954 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemData.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderItemResourceData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing the EdgeOrderItem data model. - /// Represents order item contract + /// A class representing the OrderItemResource data model. + /// Represents order item resource. /// - public partial class EdgeOrderItemData : TrackedResourceData + public partial class OrderItemResourceData : TrackedResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,24 +51,21 @@ public partial class EdgeOrderItemData : TrackedResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The location. /// Represents order item details. - /// Represents shipping and return address for order item. /// Id of the order to which order item belongs to. - /// , or is null. - public EdgeOrderItemData(AzureLocation location, EdgeOrderItemDetails orderItemDetails, EdgeOrderItemAddressDetails addressDetails, ResourceIdentifier orderId) : base(location) + /// or is null. + public OrderItemResourceData(AzureLocation location, OrderItemDetails orderItemDetails, string orderId) : base(location) { Argument.AssertNotNull(orderItemDetails, nameof(orderItemDetails)); - Argument.AssertNotNull(addressDetails, nameof(addressDetails)); Argument.AssertNotNull(orderId, nameof(orderId)); OrderItemDetails = orderItemDetails; - AddressDetails = addressDetails; OrderId = orderId; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -79,28 +76,36 @@ public EdgeOrderItemData(AzureLocation location, EdgeOrderItemDetails orderItemD /// Represents shipping and return address for order item. /// Start time of order item. /// Id of the order to which order item belongs to. + /// Provisioning state. + /// Msi identity of the resource. /// Keeps track of any properties unknown to the library. - internal EdgeOrderItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, EdgeOrderItemDetails orderItemDetails, EdgeOrderItemAddressDetails addressDetails, DateTimeOffset? startOn, ResourceIdentifier orderId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal OrderItemResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, OrderItemDetails orderItemDetails, AddressDetails addressDetails, DateTimeOffset? startOn, string orderId, ProvisioningState? provisioningState, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { OrderItemDetails = orderItemDetails; AddressDetails = addressDetails; StartOn = startOn; OrderId = orderId; + ProvisioningState = provisioningState; + Identity = identity; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal EdgeOrderItemData() + /// Initializes a new instance of for deserialization. + internal OrderItemResourceData() { } /// Represents order item details. - public EdgeOrderItemDetails OrderItemDetails { get; set; } + public OrderItemDetails OrderItemDetails { get; set; } /// Represents shipping and return address for order item. - public EdgeOrderItemAddressDetails AddressDetails { get; set; } + public AddressDetails AddressDetails { get; set; } /// Start time of order item. public DateTimeOffset? StartOn { get; } /// Id of the order to which order item belongs to. - public ResourceIdentifier OrderId { get; set; } + public string OrderId { get; set; } + /// Provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// Msi identity of the resource. + public ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.Serialization.cs new file mode 100644 index 000000000000..661d75f59988 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.EdgeOrder +{ + public partial class OrderResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + OrderResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerEdgeOrderContext.Default); + + OrderResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerEdgeOrderContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.cs similarity index 65% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.cs index f58cfb126bd3..04ef18505b59 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A Class representing an EdgeOrder along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetEdgeOrderResource method. - /// Otherwise you can get one from its parent resource using the GetEdgeOrder method. + /// A Class representing an OrderResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetOrderResource method. + /// Otherwise you can get one from its parent resource using the GetOrderResource method. /// - public partial class EdgeOrderResource : ArmResource + public partial class OrderResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The location. @@ -34,35 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _edgeOrderClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderRestClient; - private readonly EdgeOrderData _data; + private readonly ClientDiagnostics _orderResourceClientDiagnostics; + private readonly OrderResourcesRestOperations _orderResourceRestClient; + private readonly OrderResourceData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.EdgeOrder/locations/orders"; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderResource() + /// Initializes a new instance of the class for mocking. + protected OrderResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal EdgeOrderResource(ArmClient client, EdgeOrderData data) : this(client, data.Id) + internal OrderResource(ArmClient client, OrderResourceData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal EdgeOrderResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OrderResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string edgeOrderApiVersion); - _edgeOrderRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderApiVersion); + _orderResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string orderResourceApiVersion); + _orderResourceRestClient = new OrderResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, orderResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,7 +73,7 @@ internal EdgeOrderResource(ArmClient client, ResourceIdentifier id) : base(clien /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual EdgeOrderData Data + public virtual OrderResourceData Data { get { @@ -90,7 +90,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets an order. + /// Get an order. /// /// /// Request Path @@ -98,29 +98,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderResource.Get"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResource.Get"); scope.Start(); try { - var response = await _edgeOrderRestClient.GetOrderByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _orderResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -130,7 +130,7 @@ public virtual async Task> GetAsync(CancellationToke } /// - /// Gets an order. + /// Get an order. /// /// /// Request Path @@ -138,29 +138,29 @@ public virtual async Task> GetAsync(CancellationToke /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderResource.Get"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResource.Get"); scope.Start(); try { - var response = _edgeOrderRestClient.GetOrderByName(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var response = _orderResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceCollection.cs similarity index 63% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceCollection.cs index 600695cc6f2c..6edeb9e5099f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderCollection.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceCollection.cs @@ -16,28 +16,28 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetEdgeOrders method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetOrderResources method from an instance of . /// - public partial class EdgeOrderCollection : ArmCollection + public partial class OrderResourceCollection : ArmCollection { - private readonly ClientDiagnostics _edgeOrderClientDiagnostics; - private readonly EdgeOrderManagementRestOperations _edgeOrderRestClient; + private readonly ClientDiagnostics _orderResourceClientDiagnostics; + private readonly OrderResourcesRestOperations _orderResourceRestClient; - /// Initializes a new instance of the class for mocking. - protected EdgeOrderCollection() + /// Initializes a new instance of the class for mocking. + protected OrderResourceCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal EdgeOrderCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OrderResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _edgeOrderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(EdgeOrderResource.ResourceType, out string edgeOrderApiVersion); - _edgeOrderRestClient = new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, edgeOrderApiVersion); + _orderResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", OrderResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(OrderResource.ResourceType, out string orderResourceApiVersion); + _orderResourceRestClient = new OrderResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, orderResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -50,7 +50,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets an order. + /// Get an order. /// /// /// Request Path @@ -58,35 +58,35 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.Get"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.Get"); scope.Start(); try { - var response = await _edgeOrderRestClient.GetOrderByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken).ConfigureAwait(false); + var response = await _orderResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -96,7 +96,7 @@ public virtual async Task> GetAsync(AzureLocation lo } /// - /// Gets an order. + /// Get an order. /// /// /// Request Path @@ -104,35 +104,35 @@ public virtual async Task> GetAsync(AzureLocation lo /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual Response Get(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.Get"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.Get"); scope.Start(); try { - var response = _edgeOrderRestClient.GetOrderByName(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken); + var response = _orderResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -150,19 +150,19 @@ public virtual Response Get(AzureLocation location, string or /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -171,11 +171,11 @@ public virtual async Task> ExistsAsync(AzureLocation location, st { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.Exists"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.Exists"); scope.Start(); try { - var response = await _edgeOrderRestClient.GetOrderByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _orderResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -194,19 +194,19 @@ public virtual async Task> ExistsAsync(AzureLocation location, st /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -215,11 +215,11 @@ public virtual Response Exists(AzureLocation location, string orderName, C { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.Exists"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.Exists"); scope.Start(); try { - var response = _edgeOrderRestClient.GetOrderByName(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken); + var response = _orderResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -238,35 +238,35 @@ public virtual Response Exists(AzureLocation location, string orderName, C /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.GetIfExists"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.GetIfExists"); scope.Start(); try { - var response = await _edgeOrderRestClient.GetOrderByNameAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _orderResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -284,35 +284,35 @@ public virtual async Task> GetIfExistsAsync( /// /// /// Operation Id - /// GetOrderByName + /// OrderResource_Get /// /// /// Default Api Version - /// 2021-12-01 + /// 2024-02-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of Azure region. + /// The name of the Azure region. /// The name of the order. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(AzureLocation location, string orderName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - using var scope = _edgeOrderClientDiagnostics.CreateScope("EdgeOrderCollection.GetIfExists"); + using var scope = _orderResourceClientDiagnostics.CreateScope("OrderResourceCollection.GetIfExists"); scope.Start(); try { - var response = _edgeOrderRestClient.GetOrderByName(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken); + var response = _orderResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, location, orderName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new EdgeOrderResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OrderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.Serialization.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.Serialization.cs similarity index 68% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.Serialization.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.Serialization.cs index 437072a98b33..17f3e8de79ee 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.Serialization.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.EdgeOrder { - public partial class EdgeOrderData : IUtf8JsonSerializable, IJsonModel + public partial class OrderResourceData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OrderResourceData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -45,11 +45,6 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStartArray(); foreach (var item in OrderItemIds) { - if (item == null) - { - writer.WriteNullValue(); - continue; - } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -69,22 +64,27 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsDefined(OrderMode)) + { + writer.WritePropertyName("orderMode"u8); + writer.WriteStringValue(OrderMode.Value.ToString()); + } writer.WriteEndObject(); } - EdgeOrderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OrderResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(EdgeOrderData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OrderResourceData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEdgeOrderData(document.RootElement, options); + return DeserializeOrderResourceData(document.RootElement, options); } - internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, ModelReaderWriterOptions options = null) + internal static OrderResourceData DeserializeOrderResourceData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -96,9 +96,10 @@ internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, Mode string name = default; ResourceType type = default; SystemData systemData = default; - IReadOnlyList orderItemIds = default; - EdgeOrderStageDetails currentStage = default; - IReadOnlyList orderStageHistory = default; + IReadOnlyList orderItemIds = default; + StageDetails currentStage = default; + IReadOnlyList orderStageHistory = default; + OrderMode? orderMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -142,17 +143,10 @@ internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, Mode { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } + array.Add(item.GetString()); } orderItemIds = array; continue; @@ -163,7 +157,7 @@ internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, Mode { continue; } - currentStage = EdgeOrderStageDetails.DeserializeEdgeOrderStageDetails(property0.Value, options); + currentStage = StageDetails.DeserializeStageDetails(property0.Value, options); continue; } if (property0.NameEquals("orderStageHistory"u8)) @@ -172,14 +166,23 @@ internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, Mode { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(EdgeOrderStageDetails.DeserializeEdgeOrderStageDetails(item, options)); + array.Add(StageDetails.DeserializeStageDetails(item, options)); } orderStageHistory = array; continue; } + if (property0.NameEquals("orderMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + orderMode = new OrderMode(property0.Value.GetString()); + continue; + } } continue; } @@ -189,46 +192,47 @@ internal static EdgeOrderData DeserializeEdgeOrderData(JsonElement element, Mode } } serializedAdditionalRawData = rawDataDictionary; - return new EdgeOrderData( + return new OrderResourceData( id, name, type, systemData, - orderItemIds ?? new ChangeTrackingList(), + orderItemIds ?? new ChangeTrackingList(), currentStage, - orderStageHistory ?? new ChangeTrackingList(), + orderStageHistory ?? new ChangeTrackingList(), + orderMode, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerEdgeOrderContext.Default); default: - throw new FormatException($"The model {nameof(EdgeOrderData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderResourceData)} does not support writing '{options.Format}' format."); } } - EdgeOrderData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OrderResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeEdgeOrderData(document.RootElement, options); + return DeserializeOrderResourceData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(EdgeOrderData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OrderResourceData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.cs similarity index 70% rename from sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.cs rename to sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.cs index 8241248e9385..e737c94f271f 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderData.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/OrderResourceData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.EdgeOrder { /// - /// A class representing the EdgeOrder data model. + /// A class representing the OrderResource data model. /// Specifies the properties or parameters for an order. Order is a grouping of one or more order items. /// - public partial class EdgeOrderData : ResourceData + public partial class OrderResourceData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,14 +51,14 @@ public partial class EdgeOrderData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public EdgeOrderData() + /// Initializes a new instance of . + internal OrderResourceData() { - OrderItemIds = new ChangeTrackingList(); - OrderStageHistory = new ChangeTrackingList(); + OrderItemIds = new ChangeTrackingList(); + OrderStageHistory = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,20 +66,24 @@ public EdgeOrderData() /// List of order item ARM Ids which are part of an order. /// Order current status. /// Order status history. + /// Order mode. /// Keeps track of any properties unknown to the library. - internal EdgeOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList orderItemIds, EdgeOrderStageDetails currentStage, IReadOnlyList orderStageHistory, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal OrderResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList orderItemIds, StageDetails currentStage, IReadOnlyList orderStageHistory, OrderMode? orderMode, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OrderItemIds = orderItemIds; CurrentStage = currentStage; OrderStageHistory = orderStageHistory; + OrderMode = orderMode; _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of order item ARM Ids which are part of an order. - public IReadOnlyList OrderItemIds { get; } + public IReadOnlyList OrderItemIds { get; } /// Order current status. - public EdgeOrderStageDetails CurrentStage { get; } + public StageDetails CurrentStage { get; } /// Order status history. - public IReadOnlyList OrderStageHistory { get; } + public IReadOnlyList OrderStageHistory { get; } + /// Order mode. + public OrderMode? OrderMode { get; } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/AddressResourcesRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/AddressResourcesRestOperations.cs new file mode 100644 index 000000000000..ca97dddc2d81 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/AddressResourcesRestOperations.cs @@ -0,0 +1,807 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal partial class AddressResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AddressResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public AddressResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-02-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string addressName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string addressName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get information about the specified address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, addressName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddressResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AddressResourceData.DeserializeAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AddressResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get information about the specified address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, addressName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddressResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AddressResourceData.DeserializeAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AddressResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string addressName, AddressResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string addressName, AddressResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// Create a new address with the specified parameters. Existing address cannot be updated with this API and should + /// instead be updated with the Update address 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// Address details from request body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string addressName, AddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, addressName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Create a new address with the specified parameters. Existing address cannot be updated with this API and should + /// instead be updated with the Update address 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// Address details from request body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string addressName, AddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, addressName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string addressName, AddressResourcePatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string addressName, AddressResourcePatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the properties of an existing address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// Address update parameters from request body. + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string addressName, AddressResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, addressName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the properties of an existing address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// Address update parameters from request body. + /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string addressName, AddressResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, addressName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string addressName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string addressName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); + uri.AppendPath(addressName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, addressName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete an address. + /// 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 address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, addressName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the addresses 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. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the addresses 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. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the addresses available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the addresses available under the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the addresses available under the given resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the addresses available under the given resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the addresses available under the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the addresses available under the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddressResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/EdgeOrderManagementRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/EdgeOrderManagementRestOperations.cs deleted file mode 100644 index ba6164a9fde2..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/EdgeOrderManagementRestOperations.cs +++ /dev/null @@ -1,2721 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.EdgeOrder.Models; - -namespace Azure.ResourceManager.EdgeOrder -{ - internal partial class EdgeOrderManagementRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of EdgeOrderManagementRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public EdgeOrderManagementRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListAddressesAtSubscriptionLevelRequestUri(string subscriptionId, string filter, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListAddressesAtSubscriptionLevelRequest(string subscriptionId, string filter, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all the addresses available under the subscription. - /// The ID of the target subscription. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAddressesAtSubscriptionLevelAsync(string subscriptionId, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAddressesAtSubscriptionLevelRequest(subscriptionId, filter, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all the addresses available under the subscription. - /// The ID of the target subscription. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListAddressesAtSubscriptionLevel(string subscriptionId, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAddressesAtSubscriptionLevelRequest(subscriptionId, filter, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListProductFamiliesRequestUri(string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/listProductFamilies", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListProductFamiliesRequest(string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/listProductFamilies", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of product families for the given subscription. - /// The ID of the target subscription. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListProductFamiliesAsync(string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListProductFamiliesRequest(subscriptionId, content, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductFamilies value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductFamilies.DeserializeProductFamilies(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of product families for the given subscription. - /// The ID of the target subscription. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListProductFamilies(string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListProductFamiliesRequest(subscriptionId, content, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductFamilies value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductFamilies.DeserializeProductFamilies(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListConfigurationsRequestUri(string subscriptionId, ConfigurationsContent content, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/listConfigurations", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListConfigurationsRequest(string subscriptionId, ConfigurationsContent content, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/listConfigurations", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// The ID of the target subscription. - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListConfigurationsAsync(string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListConfigurationsRequest(subscriptionId, content, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductConfigurations value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductConfigurations.DeserializeProductConfigurations(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// The ID of the target subscription. - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListConfigurations(string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListConfigurationsRequest(subscriptionId, content, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductConfigurations value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductConfigurations.DeserializeProductConfigurations(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListProductFamiliesMetadataRequestUri(string subscriptionId, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/productFamiliesMetadata", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListProductFamiliesMetadataRequest(string subscriptionId, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/productFamiliesMetadata", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of product families metadata for the given subscription. - /// The ID of the target subscription. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListProductFamiliesMetadataAsync(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListProductFamiliesMetadataRequest(subscriptionId, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductFamiliesMetadataListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductFamiliesMetadataListResult.DeserializeProductFamiliesMetadataListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of product families metadata for the given subscription. - /// The ID of the target subscription. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListProductFamiliesMetadata(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListProductFamiliesMetadataRequest(subscriptionId, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductFamiliesMetadataListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductFamiliesMetadataListResult.DeserializeProductFamiliesMetadataListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderAtSubscriptionLevelRequestUri(string subscriptionId, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListOrderAtSubscriptionLevelRequest(string subscriptionId, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order at subscription level. - /// The ID of the target subscription. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListOrderAtSubscriptionLevelAsync(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderAtSubscriptionLevelRequest(subscriptionId, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order at subscription level. - /// The ID of the target subscription. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListOrderAtSubscriptionLevel(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderAtSubscriptionLevelRequest(subscriptionId, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderItemsAtSubscriptionLevelRequestUri(string subscriptionId, string filter, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListOrderItemsAtSubscriptionLevelRequest(string subscriptionId, string filter, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order item at subscription level. - /// The ID of the target subscription. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListOrderItemsAtSubscriptionLevelAsync(string subscriptionId, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderItemsAtSubscriptionLevelRequest(subscriptionId, filter, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order item at subscription level. - /// The ID of the target subscription. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListOrderItemsAtSubscriptionLevel(string subscriptionId, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderItemsAtSubscriptionLevelRequest(subscriptionId, filter, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListAddressesAtResourceGroupLevelRequestUri(string subscriptionId, string resourceGroupName, string filter, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListAddressesAtResourceGroupLevelRequest(string subscriptionId, string resourceGroupName, string filter, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all the addresses available under the given resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListAddressesAtResourceGroupLevelAsync(string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListAddressesAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, filter, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all the addresses available under the given resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListAddressesAtResourceGroupLevel(string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListAddressesAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, filter, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetAddressByNameRequestUri(string subscriptionId, string resourceGroupName, string addressName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetAddressByNameRequest(string subscriptionId, string resourceGroupName, string addressName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets information about the specified address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAddressByNameAsync(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - - using var message = CreateGetAddressByNameRequest(subscriptionId, resourceGroupName, addressName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderAddressData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = EdgeOrderAddressData.DeserializeEdgeOrderAddressData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderAddressData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets information about the specified address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetAddressByName(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - - using var message = CreateGetAddressByNameRequest(subscriptionId, resourceGroupName, addressName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderAddressData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = EdgeOrderAddressData.DeserializeEdgeOrderAddressData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderAddressData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateAddressRequestUri(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateAddressRequest(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Creates a new address with the specified parameters. Existing address can be updated with this API. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// Address details from request body. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateAddressAsync(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateAddressRequest(subscriptionId, resourceGroupName, addressName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates a new address with the specified parameters. Existing address can be updated with this API. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// Address details from request body. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateAddress(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateAddressRequest(subscriptionId, resourceGroupName, addressName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteAddressByNameRequestUri(string subscriptionId, string resourceGroupName, string addressName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteAddressByNameRequest(string subscriptionId, string resourceGroupName, string addressName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes an address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAddressByNameAsync(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - - using var message = CreateDeleteAddressByNameRequest(subscriptionId, resourceGroupName, addressName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes an address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response DeleteAddressByName(string subscriptionId, string resourceGroupName, string addressName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - - using var message = CreateDeleteAddressByNameRequest(subscriptionId, resourceGroupName, addressName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateAddressRequestUri(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressPatch patch, string ifMatch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateAddressRequest(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressPatch patch, string ifMatch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/addresses/", false); - uri.AppendPath(addressName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - if (ifMatch != null) - { - request.Headers.Add("If-Match", ifMatch); - } - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Updates the properties of an existing address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// Address update parameters from request body. - /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAddressAsync(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateAddressRequest(subscriptionId, resourceGroupName, addressName, patch, ifMatch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the properties of an existing address. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. - /// Address update parameters from request body. - /// Defines the If-Match condition. The patch will be performed only if the ETag of the job on the server matches this value. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response UpdateAddress(string subscriptionId, string resourceGroupName, string addressName, EdgeOrderAddressPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(addressName, nameof(addressName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateAddressRequest(subscriptionId, resourceGroupName, addressName, patch, ifMatch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderAtResourceGroupLevelRequestUri(string subscriptionId, string resourceGroupName, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListOrderAtResourceGroupLevelRequest(string subscriptionId, string resourceGroupName, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order at resource group level. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListOrderAtResourceGroupLevelAsync(string subscriptionId, string resourceGroupName, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order at resource group level. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListOrderAtResourceGroupLevel(string subscriptionId, string resourceGroupName, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetOrderByNameRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/orders/", false); - uri.AppendPath(orderName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetOrderByNameRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/orders/", false); - uri.AppendPath(orderName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets an order. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of Azure region. - /// The name of the order. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetOrderByNameAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - - using var message = CreateGetOrderByNameRequest(subscriptionId, resourceGroupName, location, orderName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = EdgeOrderData.DeserializeEdgeOrderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets an order. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of Azure region. - /// The name of the order. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetOrderByName(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); - - using var message = CreateGetOrderByNameRequest(subscriptionId, resourceGroupName, location, orderName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = EdgeOrderData.DeserializeEdgeOrderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderItemsAtResourceGroupLevelRequestUri(string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - return uri; - } - - internal HttpMessage CreateListOrderItemsAtResourceGroupLevelRequest(string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order item at resource group level. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListOrderItemsAtResourceGroupLevelAsync(string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderItemsAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, filter, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order item at resource group level. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListOrderItemsAtResourceGroupLevel(string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderItemsAtResourceGroupLevelRequest(subscriptionId, resourceGroupName, filter, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetOrderItemByNameRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, string expand) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - return uri; - } - - internal HttpMessage CreateGetOrderItemByNameRequest(string subscriptionId, string resourceGroupName, string orderItemName, string expand) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets an order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetOrderItemByNameAsync(string subscriptionId, string resourceGroupName, string orderItemName, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - - using var message = CreateGetOrderItemByNameRequest(subscriptionId, resourceGroupName, orderItemName, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderItemData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = EdgeOrderItemData.DeserializeEdgeOrderItemData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderItemData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets an order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetOrderItemByName(string subscriptionId, string resourceGroupName, string orderItemName, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - - using var message = CreateGetOrderItemByNameRequest(subscriptionId, resourceGroupName, orderItemName, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - EdgeOrderItemData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = EdgeOrderItemData.DeserializeEdgeOrderItemData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((EdgeOrderItemData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrderItemRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrderItemRequest(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Creates an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item API. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Order item details from request body. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrderItemAsync(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item API. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Order item details from request body. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrderItem(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteOrderItemByNameRequestUri(string subscriptionId, string resourceGroupName, string orderItemName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteOrderItemByNameRequest(string subscriptionId, string resourceGroupName, string orderItemName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes an order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteOrderItemByNameAsync(string subscriptionId, string resourceGroupName, string orderItemName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - - using var message = CreateDeleteOrderItemByNameRequest(subscriptionId, resourceGroupName, orderItemName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes an order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response DeleteOrderItemByName(string subscriptionId, string resourceGroupName, string orderItemName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - - using var message = CreateDeleteOrderItemByNameRequest(subscriptionId, resourceGroupName, orderItemName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateOrderItemRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemPatch patch, string ifMatch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateOrderItemRequest(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemPatch patch, string ifMatch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - if (ifMatch != null) - { - request.Headers.Add("If-Match", ifMatch); - } - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Updates the properties of an existing order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// order item update parameters from request body. - /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateOrderItemAsync(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, patch, ifMatch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the properties of an existing order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// order item update parameters from request body. - /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response UpdateOrderItem(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, patch, ifMatch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCancelOrderItemRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemCancellationReason cancellationReason) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCancelOrderItemRequest(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemCancellationReason cancellationReason) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(cancellationReason, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Cancel order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Reason for cancellation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CancelOrderItemAsync(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemCancellationReason cancellationReason, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); - - using var message = CreateCancelOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, cancellationReason); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Cancel order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Reason for cancellation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CancelOrderItem(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemCancellationReason cancellationReason, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); - - using var message = CreateCancelOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, cancellationReason); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateReturnOrderItemRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemReturnContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendPath("/return", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateReturnOrderItemRequest(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemReturnContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); - uri.AppendPath(orderItemName, true); - uri.AppendPath("/return", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Return order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Return order item CurrentStatus. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ReturnOrderItemAsync(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemReturnContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateReturnOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Return order item. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the order item. - /// Return order item CurrentStatus. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ReturnOrderItem(string subscriptionId, string resourceGroupName, string orderItemName, EdgeOrderItemReturnContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateReturnOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListAddressesAtSubscriptionLevelNextPageRequestUri(string nextLink, string subscriptionId, string filter, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListAddressesAtSubscriptionLevelNextPageRequest(string nextLink, string subscriptionId, string filter, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all the addresses available under the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAddressesAtSubscriptionLevelNextPageAsync(string nextLink, string subscriptionId, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, filter, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all the addresses available under the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListAddressesAtSubscriptionLevelNextPage(string nextLink, string subscriptionId, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, filter, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListProductFamiliesNextPageRequestUri(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListProductFamiliesNextPageRequest(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of product families for the given subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListProductFamiliesNextPageAsync(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListProductFamiliesNextPageRequest(nextLink, subscriptionId, content, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductFamilies value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductFamilies.DeserializeProductFamilies(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of product families for the given subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListProductFamiliesNextPage(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListProductFamiliesNextPageRequest(nextLink, subscriptionId, content, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductFamilies value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductFamilies.DeserializeProductFamilies(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListConfigurationsNextPageRequestUri(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListConfigurationsNextPageRequest(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListConfigurationsNextPageAsync(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListConfigurationsNextPageRequest(nextLink, subscriptionId, content, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductConfigurations value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductConfigurations.DeserializeProductConfigurations(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListConfigurationsNextPage(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListConfigurationsNextPageRequest(nextLink, subscriptionId, content, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductConfigurations value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductConfigurations.DeserializeProductConfigurations(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListProductFamiliesMetadataNextPageRequestUri(string nextLink, string subscriptionId, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListProductFamiliesMetadataNextPageRequest(string nextLink, string subscriptionId, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// This method provides the list of product families metadata for the given subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListProductFamiliesMetadataNextPageAsync(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListProductFamiliesMetadataNextPageRequest(nextLink, subscriptionId, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ProductFamiliesMetadataListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ProductFamiliesMetadataListResult.DeserializeProductFamiliesMetadataListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This method provides the list of product families metadata for the given subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListProductFamiliesMetadataNextPage(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListProductFamiliesMetadataNextPageRequest(nextLink, subscriptionId, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ProductFamiliesMetadataListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ProductFamiliesMetadataListResult.DeserializeProductFamiliesMetadataListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderAtSubscriptionLevelNextPageRequestUri(string nextLink, string subscriptionId, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListOrderAtSubscriptionLevelNextPageRequest(string nextLink, string subscriptionId, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order at subscription level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListOrderAtSubscriptionLevelNextPageAsync(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order at subscription level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListOrderAtSubscriptionLevelNextPage(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderItemsAtSubscriptionLevelNextPageRequestUri(string nextLink, string subscriptionId, string filter, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListOrderItemsAtSubscriptionLevelNextPageRequest(string nextLink, string subscriptionId, string filter, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order item at subscription level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListOrderItemsAtSubscriptionLevelNextPageAsync(string nextLink, string subscriptionId, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, filter, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order item at subscription level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListOrderItemsAtSubscriptionLevelNextPage(string nextLink, string subscriptionId, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, subscriptionId, filter, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListAddressesAtResourceGroupLevelNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListAddressesAtResourceGroupLevelNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all the addresses available under the given resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListAddressesAtResourceGroupLevelNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListAddressesAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all the addresses available under the given resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of address. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListAddressesAtResourceGroupLevelNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListAddressesAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AddressResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AddressResourceList.DeserializeAddressResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderAtResourceGroupLevelNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListOrderAtResourceGroupLevelNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order at resource group level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListOrderAtResourceGroupLevelNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order at resource group level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListOrderAtResourceGroupLevelNextPage(string nextLink, string subscriptionId, string resourceGroupName, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOrderItemsAtResourceGroupLevelNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListOrderItemsAtResourceGroupLevelNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists order item at resource group level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListOrderItemsAtResourceGroupLevelNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderItemsAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, expand, skipToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists order item at resource group level. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListOrderItemsAtResourceGroupLevelNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListOrderItemsAtResourceGroupLevelNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, expand, skipToken); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrderItemResourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderItemResourcesRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderItemResourcesRestOperations.cs new file mode 100644 index 000000000000..7dbd9592a378 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderItemResourcesRestOperations.cs @@ -0,0 +1,1029 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal partial class OrderItemResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OrderItemResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OrderItemResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-02-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, string expand) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string orderItemName, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get an order item. + /// 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 order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, orderItemName, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderItemResourceData.DeserializeOrderItemResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OrderItemResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get an order item. + /// 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 order item. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, orderItemName, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderItemResourceData.DeserializeOrderItemResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OrderItemResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// + /// Create an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item + /// 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 order item. + /// Order item details from request body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, orderItemName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Create an order item. Existing order item cannot be updated with this api and should instead be updated with the Update order item + /// 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 order item. + /// Order item details from request body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, orderItemName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourcePatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourcePatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the properties of an existing order item. + /// 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 order item. + /// Order item update parameters from request body. + /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, orderItemName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the properties of an existing order item. + /// 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 order item. + /// Order item update parameters from request body. + /// Defines the If-Match condition. The patch will be performed only if the ETag of the order on the server matches this value. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string orderItemName, OrderItemResourcePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, orderItemName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string orderItemName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string orderItemName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete an order item. + /// 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 order item. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string orderItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, orderItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete an order item. + /// 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 order item. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string orderItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, orderItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List order items 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. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, expand, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List order items 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. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, expand, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter, string expand, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter, string expand, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List order items at subscription level. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, expand, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List order items at subscription level. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter, expand, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCancelRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, CancellationReason cancellationReason) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCancelRequest(string subscriptionId, string resourceGroupName, string orderItemName, CancellationReason cancellationReason) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(cancellationReason, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Cancel order item. + /// 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 order item. + /// Reason for cancellation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CancelAsync(string subscriptionId, string resourceGroupName, string orderItemName, CancellationReason cancellationReason, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); + + using var message = CreateCancelRequest(subscriptionId, resourceGroupName, orderItemName, cancellationReason); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Cancel order item. + /// 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 order item. + /// Reason for cancellation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Cancel(string subscriptionId, string resourceGroupName, string orderItemName, CancellationReason cancellationReason, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(cancellationReason, nameof(cancellationReason)); + + using var message = CreateCancelRequest(subscriptionId, resourceGroupName, orderItemName, cancellationReason); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateReturnOrderItemRequestUri(string subscriptionId, string resourceGroupName, string orderItemName, ReturnOrderItemDetails details) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendPath("/return", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateReturnOrderItemRequest(string subscriptionId, string resourceGroupName, string orderItemName, ReturnOrderItemDetails details) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orderItems/", false); + uri.AppendPath(orderItemName, true); + uri.AppendPath("/return", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(details, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Return order item. + /// 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 order item. + /// Return order item details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ReturnOrderItemAsync(string subscriptionId, string resourceGroupName, string orderItemName, ReturnOrderItemDetails details, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(details, nameof(details)); + + using var message = CreateReturnOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, details); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Return order item. + /// 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 order item. + /// Return order item details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ReturnOrderItem(string subscriptionId, string resourceGroupName, string orderItemName, ReturnOrderItemDetails details, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderItemName, nameof(orderItemName)); + Argument.AssertNotNull(details, nameof(details)); + + using var message = CreateReturnOrderItemRequest(subscriptionId, resourceGroupName, orderItemName, details); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, string expand, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List order items at resource group level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, expand, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List order items at resource group level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, expand, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter, string expand, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter, string expand, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List order items at subscription level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, expand, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List order items at subscription level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $filter is supported to filter based on order id and order Item Type. Filter supports only equals operation. + /// $expand is supported on parent device details, device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Parent Device Details for order item provides details on the devices of the product, Device Details for order item provides details on the devices of the child configurations of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter, expand, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderItemResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderItemResourceList.DeserializeOrderItemResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderResourcesRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderResourcesRestOperations.cs new file mode 100644 index 000000000000..7a7aa1396044 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrderResourcesRestOperations.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal partial class OrderResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OrderResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OrderResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-02-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/orders/", false); + uri.AppendPath(orderName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/orders/", false); + uri.AppendPath(orderName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get an order. + /// 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. + /// The name of the order. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, orderName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderResourceData.DeserializeOrderResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OrderResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get an order. + /// 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. + /// The name of the order. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(orderName, nameof(orderName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, orderName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderResourceData.DeserializeOrderResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OrderResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrdersOperationGroupRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrdersOperationGroupRestOperations.cs new file mode 100644 index 000000000000..fc840dadc04f --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/OrdersOperationGroupRestOperations.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal partial class OrdersOperationGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OrdersOperationGroupRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OrdersOperationGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-02-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List orders at subscription level. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List orders at subscription level. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/orders", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List orders 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. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List orders 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. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List orders at subscription level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List orders at subscription level. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on Get list of orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string skipToken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string skipToken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List orders at resource group level. + /// The URL to the next page of results. + /// 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 orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List orders at resource group level. + /// The URL to the next page of results. + /// 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 orders, which provides the next page in the list of orders. + /// $top is supported on fetching list of resources. $top=10 means that the first 10 items in the list will be returned to the API caller. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, skipToken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrderResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OrderResourceList.DeserializeOrderResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/ProductsAndConfigurationsOperationGroupRestOperations.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/ProductsAndConfigurationsOperationGroupRestOperations.cs new file mode 100644 index 000000000000..33ed80c7369d --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/RestOperations/ProductsAndConfigurationsOperationGroupRestOperations.cs @@ -0,0 +1,573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder +{ + internal partial class ProductsAndConfigurationsOperationGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductsAndConfigurationsOperationGroupRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public ProductsAndConfigurationsOperationGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-02-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListConfigurationsRequestUri(string subscriptionId, ConfigurationsContent content, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/listConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + return uri; + } + + internal HttpMessage CreateListConfigurationsRequest(string subscriptionId, ConfigurationsContent content, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/listConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// List configurations for the given product family, product line and product for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListConfigurationsAsync(string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListConfigurationsRequest(subscriptionId, content, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Configurations value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = Configurations.DeserializeConfigurations(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List configurations for the given product family, product line and product for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListConfigurations(string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListConfigurationsRequest(subscriptionId, content, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Configurations value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = Configurations.DeserializeConfigurations(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListProductFamiliesRequestUri(string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/listProductFamilies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + return uri; + } + + internal HttpMessage CreateListProductFamiliesRequest(string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/listProductFamilies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// List product families for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListProductFamiliesAsync(string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListProductFamiliesRequest(subscriptionId, content, expand, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductFamilies value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProductFamilies.DeserializeProductFamilies(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List product families for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListProductFamilies(string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListProductFamiliesRequest(subscriptionId, content, expand, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductFamilies value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProductFamilies.DeserializeProductFamilies(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListProductFamiliesMetadataRequestUri(string subscriptionId, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/productFamiliesMetadata", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + return uri; + } + + internal HttpMessage CreateListProductFamiliesMetadataRequest(string subscriptionId, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.EdgeOrder/productFamiliesMetadata", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List product families metadata for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListProductFamiliesMetadataAsync(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListProductFamiliesMetadataRequest(subscriptionId, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductFamiliesMetadata value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List product families metadata for the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListProductFamiliesMetadata(string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListProductFamiliesMetadataRequest(subscriptionId, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductFamiliesMetadata value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListConfigurationsNextPageRequestUri(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListConfigurationsNextPageRequest(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List configurations for the given product family, product line and product for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListConfigurationsNextPageAsync(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListConfigurationsNextPageRequest(nextLink, subscriptionId, content, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Configurations value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = Configurations.DeserializeConfigurations(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List configurations for the given product family, product line and product for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListConfigurationsNextPage(string nextLink, string subscriptionId, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListConfigurationsNextPageRequest(nextLink, subscriptionId, content, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Configurations value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = Configurations.DeserializeConfigurations(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListProductFamiliesNextPageRequestUri(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListProductFamiliesNextPageRequest(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List product families for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListProductFamiliesNextPageAsync(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListProductFamiliesNextPageRequest(nextLink, subscriptionId, content, expand, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductFamilies value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProductFamilies.DeserializeProductFamilies(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List product families for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListProductFamiliesNextPage(string nextLink, string subscriptionId, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListProductFamiliesNextPageRequest(nextLink, subscriptionId, content, expand, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductFamilies value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProductFamilies.DeserializeProductFamilies(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListProductFamiliesMetadataNextPageRequestUri(string nextLink, string subscriptionId, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListProductFamiliesMetadataNextPageRequest(string nextLink, string subscriptionId, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List product families metadata for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListProductFamiliesMetadataNextPageAsync(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListProductFamiliesMetadataNextPageRequest(nextLink, subscriptionId, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductFamiliesMetadata value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List product families metadata for the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListProductFamiliesMetadataNextPage(string nextLink, string subscriptionId, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListProductFamiliesMetadataNextPageRequest(nextLink, subscriptionId, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductFamiliesMetadata value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProductFamiliesMetadata.DeserializeProductFamiliesMetadata(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/autorest.md b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/autorest.md deleted file mode 100644 index ce5764286e24..000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/autorest.md +++ /dev/null @@ -1,134 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: EdgeOrder -namespace: Azure.ResourceManager.EdgeOrder -require: https://github.com/Azure/azure-rest-api-specs/blob/58891380ba22c3565ca884dee3831445f638b545/specification/edgeorder/resource-manager/readme.md -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -list-exception: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} - -format-by-name-rules: - 'tenantId': 'uuid' - 'etag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - Rp: RP - -override-operation-name: - CancelOrderItem: Cancel - ReturnOrderItem: Return - -rename-mapping: - AddressResource: EdgeOrderAddress - AddressValidationStatus: EdgeOrderAddressValidationStatus - ContactDetails: EdgeOrderAddressContactDetails - ShippingAddress: EdgeOrderShippingAddress - OrderItemResource: EdgeOrderItem - OrderItemResource.properties.orderId: -|arm-id - CancellationReason: EdgeOrderItemCancellationReason - ReturnOrderItemDetails: EdgeOrderItemReturnContent - ReturnOrderItemDetails.shippingBoxRequired: IsShippingBoxRequired - AddressDetails: EdgeOrderItemAddressDetails - AddressProperties: EdgeOrderItemAddressProperties - OrderItemDetails: EdgeOrderItemDetails - OrderItemDetails.managementRpDetails: FirstOrDefaultManagement - OrderResource: EdgeOrder - OrderResource.properties.orderItemIds: -|arm-id - StageDetails: EdgeOrderStageDetails - StageName: EdgeOrderStageName - StageStatus: EdgeOrderStageStatus - ProductFamiliesMetadata: ProductFamiliesMetadataListResult - ProductFamiliesMetadataDetails: ProductFamiliesMetadata - ActionStatusEnum: EdgeOrderActionStatus - AddressType: EdgeOrderAddressType - AvailabilityInformation: ProductAvailabilityInformation - AvailabilityStage: ProductAvailabilityStage - AvailabilityStage.Signup: SignUp - DisabledReason: ProductDisabledReason - DescriptionType: ProductDescriptionType - DisplayInfo: ProductDisplayInfo - NotificationPreference.sendNotification: IsNotificationRequired - OrderItemCancellationEnum: OrderItemCancellationStatus - OrderItemReturnEnum: OrderItemReturnStatus - Pav2MeterDetails.meterGuid: -|uuid - WeightMeasurementUnit.LBS: Lbs - WeightMeasurementUnit.KGS: Kgs - CostInformation: EdgeOrderProductCostInformation - BillingMeterDetails: EdgeOrderProductBillingMeterDetails - MeterDetails: EdgeOrderProductMeterDetails - MeteringType: EdgeOrderProductMeteringType - ChargingType: EdgeOrderProductChargingType - DeviceDetails: EdgeOrderProductDeviceDetails - ImageInformation: EdgeOrderProductImageInformation - ImageType: EdgeOrderProductImageType - LengthHeightUnit: ProductLengthHeightWidthUnit - WeightMeasurementUnit: ProductWeightMeasurementUnit - LinkType: ProductLinkType - -directive: - - remove-operation: ListOperations - - rename-model: - from: Configuration - to: ProductConfiguration - - rename-model: - from: Configurations - to: ProductConfigurations - - rename-model: - from: Description - to: ProductDescription - - rename-model: - from: Dimensions - to: ProductDimensions - - rename-model: - from: Link - to: ProductLink - - rename-model: - from: Preferences - to: OrderItemPreferences - - rename-model: - from: Product - to: EdgeOrderProduct - - rename-model: - from: Specification - to: ProductSpecification - -``` diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/tsp-location.yaml b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/tsp-location.yaml new file mode 100644 index 000000000000..a986b7ea2d37 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edgeorder/EdgeOrder.Management +commit: 1114538fd24217b94902430aa2f9b227f5c55727 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/