From c10cd766e34f18ffa11baeb40471c6cb1093e0db Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 May 2025 08:00:03 +0000 Subject: [PATCH] CodeGen from PR 34238 in Azure/azure-rest-api-specs Merge 5b41d6fca6a5d0ab6420d2b567d83f0704ff12f5 into 37a849b656ecfb33424822b9f245aebff2ae994f --- sdk/edgeorder/azure-mgmt-edgeorder/README.md | 6 +- sdk/edgeorder/azure-mgmt-edgeorder/_meta.json | 11 +- .../apiview-properties.json | 166 + .../azure/mgmt/edgeorder/__init__.py | 16 +- .../azure/mgmt/edgeorder/_client.py | 154 + .../azure/mgmt/edgeorder/_configuration.py | 28 +- .../_edge_order_management_client.py | 111 - .../azure/mgmt/edgeorder/_patch.py | 9 +- .../azure/mgmt/edgeorder/_utils/__init__.py | 6 + .../azure/mgmt/edgeorder/_utils/model_base.py | 1232 +++++ .../serialization.py} | 566 +-- .../azure/mgmt/edgeorder/_utils/utils.py | 40 + .../azure/mgmt/edgeorder/_vendor.py | 26 - .../azure/mgmt/edgeorder/_version.py | 4 +- .../azure/mgmt/edgeorder/aio/__init__.py | 16 +- .../azure/mgmt/edgeorder/aio/_client.py | 159 + .../mgmt/edgeorder/aio/_configuration.py | 28 +- .../aio/_edge_order_management_client.py | 113 - .../azure/mgmt/edgeorder/aio/_patch.py | 9 +- .../azure/mgmt/edgeorder/aio/_vendor.py | 26 - .../mgmt/edgeorder/aio/operations/__init__.py | 26 +- ...nt_client_operations.py => _operations.py} | 3675 +++++++++------ .../mgmt/edgeorder/aio/operations/_patch.py | 9 +- .../azure/mgmt/edgeorder/models/__init__.py | 273 +- ...r_management_client_enums.py => _enums.py} | 168 +- .../azure/mgmt/edgeorder/models/_models.py | 3416 ++++++++++++++ .../mgmt/edgeorder/models/_models_py3.py | 3147 ------------- .../azure/mgmt/edgeorder/models/_patch.py | 9 +- .../mgmt/edgeorder/operations/__init__.py | 26 +- ...nt_client_operations.py => _operations.py} | 4125 ++++++++++------- .../azure/mgmt/edgeorder/operations/_patch.py | 9 +- .../generated_samples/cancel_order_item.py | 14 +- .../generated_samples/create_address.py | 16 +- .../generated_samples/create_order_item.py | 18 +- .../delete_address_by_name.py | 14 +- .../delete_order_item_by_name.py | 14 +- .../generated_samples/get_address_by_name.py | 14 +- .../generated_samples/get_order_by_name.py | 14 +- .../get_order_item_by_name.py | 14 +- .../list_addresses_at_resource_group_level.py | 12 +- .../list_addresses_at_subscription_level.py | 12 +- .../generated_samples/list_configurations.py | 30 +- .../generated_samples/list_operations.py | 10 +- .../list_order_at_resource_group_level.py | 12 +- .../list_order_at_subscription_level.py | 12 +- ...ist_order_items_at_resource_group_level.py | 12 +- .../list_order_items_at_subscription_level.py | 12 +- .../list_product_families.py | 12 +- .../list_product_families_metadata.py | 12 +- .../generated_samples/return_order_item.py | 15 +- .../generated_samples/update_address.py | 14 +- .../generated_samples/update_order_item.py | 14 +- .../generated_tests/conftest.py | 22 +- ...edge_order_address_resources_operations.py | 144 + ...rder_address_resources_operations_async.py | 151 + .../test_edge_order_management.py | 526 --- .../test_edge_order_management_async.py | 545 --- .../test_edge_order_operations.py | 27 + .../test_edge_order_operations_async.py | 28 + ...e_order_order_item_resources_operations.py | 445 ++ ...r_order_item_resources_operations_async.py | 454 ++ ...t_edge_order_order_resources_operations.py | 31 + ..._order_order_resources_operations_async.py | 32 + ...order_orders_operation_group_operations.py | 37 + ...orders_operation_group_operations_async.py | 38 + ...nfigurations_operation_group_operations.py | 82 + ...ations_operation_group_operations_async.py | 83 + sdk/edgeorder/azure-mgmt-edgeorder/setup.py | 13 +- .../azure-mgmt-edgeorder/tsp-location.yaml | 4 + 69 files changed, 12110 insertions(+), 8458 deletions(-) create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/apiview-properties.json create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_client.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/__init__.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/model_base.py rename sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/{_serialization.py => _utils/serialization.py} (83%) create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/utils.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_vendor.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_client.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_vendor.py rename sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/{_edge_order_management_client_operations.py => _operations.py} (55%) rename sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/{_edge_order_management_client_enums.py => _enums.py} (62%) create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models_py3.py rename sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/{_edge_order_management_client_operations.py => _operations.py} (58%) create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations_async.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management.py delete mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations_async.py create mode 100644 sdk/edgeorder/azure-mgmt-edgeorder/tsp-location.yaml diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/README.md b/sdk/edgeorder/azure-mgmt-edgeorder/README.md index e82b1e4d3eda..8c872f0010d6 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/README.md +++ b/sdk/edgeorder/azure-mgmt-edgeorder/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Edge Order Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json b/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json index 6164984b1858..d812cc6d9251 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json +++ b/sdk/edgeorder/azure-mgmt-edgeorder/_meta.json @@ -1,11 +1,6 @@ { - "commit": "2776cb32cd6ca9ea953a13ae26c954b989e83367", + "commit": "1114538fd24217b94902430aa2f9b227f5c55727", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.19.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/edgeorder/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2021-12 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/edgeorder/resource-manager/readme.md" + "typespec_src": "specification/edgeorder/EdgeOrder.Management", + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/apiview-properties.json b/sdk/edgeorder/azure-mgmt-edgeorder/apiview-properties.json new file mode 100644 index 000000000000..354f7557f3a9 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/apiview-properties.json @@ -0,0 +1,166 @@ +{ + "CrossLanguagePackageId": "Microsoft.EdgeOrder", + "CrossLanguageDefinitionId": { + "azure.mgmt.edgeorder.models.AdditionalConfiguration": "Microsoft.EdgeOrder.AdditionalConfiguration", + "azure.mgmt.edgeorder.models.AddressDetails": "Microsoft.EdgeOrder.AddressDetails", + "azure.mgmt.edgeorder.models.AddressProperties": "Microsoft.EdgeOrder.AddressProperties", + "azure.mgmt.edgeorder.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.edgeorder.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.edgeorder.models.AddressResource": "Microsoft.EdgeOrder.AddressResource", + "azure.mgmt.edgeorder.models.AddressUpdateParameter": "Microsoft.EdgeOrder.AddressUpdateParameter", + "azure.mgmt.edgeorder.models.AddressUpdateProperties": "Microsoft.EdgeOrder.AddressUpdateProperties", + "azure.mgmt.edgeorder.models.AvailabilityInformation": "Microsoft.EdgeOrder.AvailabilityInformation", + "azure.mgmt.edgeorder.models.BasicInformation": "Microsoft.EdgeOrder.BasicInformation", + "azure.mgmt.edgeorder.models.BillingMeterDetails": "Microsoft.EdgeOrder.BillingMeterDetails", + "azure.mgmt.edgeorder.models.CancellationReason": "Microsoft.EdgeOrder.CancellationReason", + "azure.mgmt.edgeorder.models.CategoryInformation": "Microsoft.EdgeOrder.CategoryInformation", + "azure.mgmt.edgeorder.models.ChildConfiguration": "Microsoft.EdgeOrder.ChildConfiguration", + "azure.mgmt.edgeorder.models.ChildConfigurationFilter": "Microsoft.EdgeOrder.ChildConfigurationFilter", + "azure.mgmt.edgeorder.models.ChildConfigurationProperties": "Microsoft.EdgeOrder.ChildConfigurationProperties", + "azure.mgmt.edgeorder.models.CommonProperties": "Microsoft.EdgeOrder.CommonProperties", + "azure.mgmt.edgeorder.models.Configuration": "Microsoft.EdgeOrder.Configuration", + "azure.mgmt.edgeorder.models.ConfigurationDeviceDetails": "Microsoft.EdgeOrder.ConfigurationDeviceDetails", + "azure.mgmt.edgeorder.models.ConfigurationFilter": "Microsoft.EdgeOrder.ConfigurationFilter", + "azure.mgmt.edgeorder.models.ConfigurationProperties": "Microsoft.EdgeOrder.ConfigurationProperties", + "azure.mgmt.edgeorder.models.ConfigurationsRequest": "Microsoft.EdgeOrder.ConfigurationsRequest", + "azure.mgmt.edgeorder.models.ContactDetails": "Microsoft.EdgeOrder.ContactDetails", + "azure.mgmt.edgeorder.models.CostInformation": "Microsoft.EdgeOrder.CostInformation", + "azure.mgmt.edgeorder.models.CustomerSubscriptionDetails": "Microsoft.EdgeOrder.CustomerSubscriptionDetails", + "azure.mgmt.edgeorder.models.CustomerSubscriptionRegisteredFeatures": "Microsoft.EdgeOrder.CustomerSubscriptionRegisteredFeatures", + "azure.mgmt.edgeorder.models.Description": "Microsoft.EdgeOrder.Description", + "azure.mgmt.edgeorder.models.DeviceDetails": "Microsoft.EdgeOrder.DeviceDetails", + "azure.mgmt.edgeorder.models.DevicePresenceVerificationDetails": "Microsoft.EdgeOrder.DevicePresenceVerificationDetails", + "azure.mgmt.edgeorder.models.Dimensions": "Microsoft.EdgeOrder.Dimensions", + "azure.mgmt.edgeorder.models.DisplayInfo": "Microsoft.EdgeOrder.DisplayInfo", + "azure.mgmt.edgeorder.models.EncryptionPreferences": "Microsoft.EdgeOrder.EncryptionPreferences", + "azure.mgmt.edgeorder.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.edgeorder.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.edgeorder.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.edgeorder.models.FilterableProperty": "Microsoft.EdgeOrder.FilterableProperty", + "azure.mgmt.edgeorder.models.ForwardShippingDetails": "Microsoft.EdgeOrder.ForwardShippingDetails", + "azure.mgmt.edgeorder.models.GroupedChildConfigurations": "Microsoft.EdgeOrder.GroupedChildConfigurations", + "azure.mgmt.edgeorder.models.HierarchyInformation": "Microsoft.EdgeOrder.HierarchyInformation", + "azure.mgmt.edgeorder.models.ImageInformation": "Microsoft.EdgeOrder.ImageInformation", + "azure.mgmt.edgeorder.models.Link": "Microsoft.EdgeOrder.Link", + "azure.mgmt.edgeorder.models.ManagementResourcePreferences": "Microsoft.EdgeOrder.ManagementResourcePreferences", + "azure.mgmt.edgeorder.models.MeterDetails": "Microsoft.EdgeOrder.MeterDetails", + "azure.mgmt.edgeorder.models.NotificationPreference": "Microsoft.EdgeOrder.NotificationPreference", + "azure.mgmt.edgeorder.models.OkResponse": "TypeSpec.Http.OkResponse", + "azure.mgmt.edgeorder.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.edgeorder.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.edgeorder.models.OrderItemDetails": "Microsoft.EdgeOrder.OrderItemDetails", + "azure.mgmt.edgeorder.models.OrderItemDetailsUpdateParameter": "Microsoft.EdgeOrder.OrderItemDetailsUpdateParameter", + "azure.mgmt.edgeorder.models.OrderItemProperties": "Microsoft.EdgeOrder.OrderItemProperties", + "azure.mgmt.edgeorder.models.OrderItemResource": "Microsoft.EdgeOrder.OrderItemResource", + "azure.mgmt.edgeorder.models.OrderItemUpdateParameter": "Microsoft.EdgeOrder.OrderItemUpdateParameter", + "azure.mgmt.edgeorder.models.OrderItemUpdateProperties": "Microsoft.EdgeOrder.OrderItemUpdateProperties", + "azure.mgmt.edgeorder.models.OrderProperties": "Microsoft.EdgeOrder.OrderProperties", + "azure.mgmt.edgeorder.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.edgeorder.models.OrderResource": "Microsoft.EdgeOrder.OrderResource", + "azure.mgmt.edgeorder.models.Pav2MeterDetails": "Microsoft.EdgeOrder.Pav2MeterDetails", + "azure.mgmt.edgeorder.models.Preferences": "Microsoft.EdgeOrder.Preferences", + "azure.mgmt.edgeorder.models.Product": "Microsoft.EdgeOrder.Product", + "azure.mgmt.edgeorder.models.ProductDetails": "Microsoft.EdgeOrder.ProductDetails", + "azure.mgmt.edgeorder.models.ProductDetailsUpdateParameter": "Microsoft.EdgeOrder.ProductDetailsUpdateParameter", + "azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails": "Microsoft.EdgeOrder.ProductFamiliesMetadataDetails", + "azure.mgmt.edgeorder.models.ProductFamiliesRequest": "Microsoft.EdgeOrder.ProductFamiliesRequest", + "azure.mgmt.edgeorder.models.ProductFamily": "Microsoft.EdgeOrder.ProductFamily", + "azure.mgmt.edgeorder.models.ProductFamilyProperties": "Microsoft.EdgeOrder.ProductFamilyProperties", + "azure.mgmt.edgeorder.models.ProductLine": "Microsoft.EdgeOrder.ProductLine", + "azure.mgmt.edgeorder.models.ProductLineProperties": "Microsoft.EdgeOrder.ProductLineProperties", + "azure.mgmt.edgeorder.models.ProductProperties": "Microsoft.EdgeOrder.ProductProperties", + "azure.mgmt.edgeorder.models.ProvisioningDetails": "Microsoft.EdgeOrder.ProvisioningDetails", + "azure.mgmt.edgeorder.models.PurchaseMeterDetails": "Microsoft.EdgeOrder.PurchaseMeterDetails", + "azure.mgmt.edgeorder.models.ResourceIdentity": "Microsoft.EdgeOrder.ResourceIdentity", + "azure.mgmt.edgeorder.models.ResourceProviderDetails": "Microsoft.EdgeOrder.ResourceProviderDetails", + "azure.mgmt.edgeorder.models.ReturnOrderItemDetails": "Microsoft.EdgeOrder.ReturnOrderItemDetails", + "azure.mgmt.edgeorder.models.ReverseShippingDetails": "Microsoft.EdgeOrder.ReverseShippingDetails", + "azure.mgmt.edgeorder.models.ShippingAddress": "Microsoft.EdgeOrder.ShippingAddress", + "azure.mgmt.edgeorder.models.SiteDetails": "Microsoft.EdgeOrder.SiteDetails", + "azure.mgmt.edgeorder.models.Specification": "Microsoft.EdgeOrder.Specification", + "azure.mgmt.edgeorder.models.StageDetails": "Microsoft.EdgeOrder.StageDetails", + "azure.mgmt.edgeorder.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.edgeorder.models.TermCommitmentInformation": "Microsoft.EdgeOrder.TermCommitmentInformation", + "azure.mgmt.edgeorder.models.TermCommitmentPreferences": "Microsoft.EdgeOrder.TermCommitmentPreferences", + "azure.mgmt.edgeorder.models.TermTypeDetails": "Microsoft.EdgeOrder.TermTypeDetails", + "azure.mgmt.edgeorder.models.TransportPreferences": "Microsoft.EdgeOrder.TransportPreferences", + "azure.mgmt.edgeorder.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.edgeorder.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.edgeorder.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.edgeorder.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.edgeorder.models.AddressClassification": "Microsoft.EdgeOrder.AddressClassification", + "azure.mgmt.edgeorder.models.AddressType": "Microsoft.EdgeOrder.AddressType", + "azure.mgmt.edgeorder.models.AddressValidationStatus": "Microsoft.EdgeOrder.AddressValidationStatus", + "azure.mgmt.edgeorder.models.ProvisioningState": "Microsoft.EdgeOrder.ProvisioningState", + "azure.mgmt.edgeorder.models.DoubleEncryptionStatus": "Microsoft.EdgeOrder.DoubleEncryptionStatus", + "azure.mgmt.edgeorder.models.IdentificationType": "Microsoft.EdgeOrder.IdentificationType", + "azure.mgmt.edgeorder.models.ProvisioningSupport": "Microsoft.EdgeOrder.ProvisioningSupport", + "azure.mgmt.edgeorder.models.AutoProvisioningStatus": "Microsoft.EdgeOrder.AutoProvisioningStatus", + "azure.mgmt.edgeorder.models.DevicePresenceVerificationStatus": "Microsoft.EdgeOrder.DevicePresenceVerificationStatus", + "azure.mgmt.edgeorder.models.TermCommitmentType": "Microsoft.EdgeOrder.TermCommitmentType", + "azure.mgmt.edgeorder.models.OrderItemType": "Microsoft.EdgeOrder.OrderItemType", + "azure.mgmt.edgeorder.models.OrderMode": "Microsoft.EdgeOrder.OrderMode", + "azure.mgmt.edgeorder.models.StageStatus": "Microsoft.EdgeOrder.StageStatus", + "azure.mgmt.edgeorder.models.StageName": "Microsoft.EdgeOrder.StageName", + "azure.mgmt.edgeorder.models.NotificationStageName": "Microsoft.EdgeOrder.NotificationStageName", + "azure.mgmt.edgeorder.models.TransportShipmentTypes": "Microsoft.EdgeOrder.TransportShipmentTypes", + "azure.mgmt.edgeorder.models.OrderItemCancellationEnum": "Microsoft.EdgeOrder.OrderItemCancellationEnum", + "azure.mgmt.edgeorder.models.ActionStatusEnum": "Microsoft.EdgeOrder.ActionStatusEnum", + "azure.mgmt.edgeorder.models.OrderItemReturnEnum": "Microsoft.EdgeOrder.OrderItemReturnEnum", + "azure.mgmt.edgeorder.models.DescriptionType": "Microsoft.EdgeOrder.DescriptionType", + "azure.mgmt.edgeorder.models.LinkType": "Microsoft.EdgeOrder.LinkType", + "azure.mgmt.edgeorder.models.ImageType": "Microsoft.EdgeOrder.ImageType", + "azure.mgmt.edgeorder.models.BillingType": "Microsoft.EdgeOrder.BillingType", + "azure.mgmt.edgeorder.models.ChargingType": "Microsoft.EdgeOrder.ChargingType", + "azure.mgmt.edgeorder.models.MeteringType": "Microsoft.EdgeOrder.MeteringType", + "azure.mgmt.edgeorder.models.AvailabilityStage": "Microsoft.EdgeOrder.AvailabilityStage", + "azure.mgmt.edgeorder.models.DisabledReason": "Microsoft.EdgeOrder.DisabledReason", + "azure.mgmt.edgeorder.models.FulfillmentType": "Microsoft.EdgeOrder.FulfillmentType", + "azure.mgmt.edgeorder.models.SupportedFilterTypes": "Microsoft.EdgeOrder.SupportedFilterTypes", + "azure.mgmt.edgeorder.models.LengthHeightUnit": "Microsoft.EdgeOrder.LengthHeightUnit", + "azure.mgmt.edgeorder.models.WeightMeasurementUnit": "Microsoft.EdgeOrder.WeightMeasurementUnit", + "azure.mgmt.edgeorder.models.ChildConfigurationType": "Microsoft.EdgeOrder.ChildConfigurationType", + "azure.mgmt.edgeorder.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.edgeorder.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.get": "Microsoft.EdgeOrder.AddressResources.get", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.get": "Microsoft.EdgeOrder.AddressResources.get", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.begin_create": "Microsoft.EdgeOrder.AddressResources.create", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.begin_create": "Microsoft.EdgeOrder.AddressResources.create", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.begin_update": "Microsoft.EdgeOrder.AddressResources.update", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.begin_update": "Microsoft.EdgeOrder.AddressResources.update", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.begin_delete": "Microsoft.EdgeOrder.AddressResources.delete", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.begin_delete": "Microsoft.EdgeOrder.AddressResources.delete", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.list_by_resource_group": "Microsoft.EdgeOrder.AddressResources.listByResourceGroup", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.list_by_resource_group": "Microsoft.EdgeOrder.AddressResources.listByResourceGroup", + "azure.mgmt.edgeorder.operations.AddressResourcesOperations.list_by_subscription": "Microsoft.EdgeOrder.AddressResources.listBySubscription", + "azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations.list_by_subscription": "Microsoft.EdgeOrder.AddressResources.listBySubscription", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.get": "Microsoft.EdgeOrder.OrderItemResources.get", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.get": "Microsoft.EdgeOrder.OrderItemResources.get", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.begin_create": "Microsoft.EdgeOrder.OrderItemResources.create", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.begin_create": "Microsoft.EdgeOrder.OrderItemResources.create", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.begin_update": "Microsoft.EdgeOrder.OrderItemResources.update", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.begin_update": "Microsoft.EdgeOrder.OrderItemResources.update", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.begin_delete": "Microsoft.EdgeOrder.OrderItemResources.delete", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.begin_delete": "Microsoft.EdgeOrder.OrderItemResources.delete", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.list_by_resource_group": "Microsoft.EdgeOrder.OrderItemResources.listByResourceGroup", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.list_by_resource_group": "Microsoft.EdgeOrder.OrderItemResources.listByResourceGroup", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.list_by_subscription": "Microsoft.EdgeOrder.OrderItemResources.listBySubscription", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.list_by_subscription": "Microsoft.EdgeOrder.OrderItemResources.listBySubscription", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.cancel": "Microsoft.EdgeOrder.OrderItemResources.cancel", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.cancel": "Microsoft.EdgeOrder.OrderItemResources.cancel", + "azure.mgmt.edgeorder.operations.OrderItemResourcesOperations.begin_return_order_item": "Microsoft.EdgeOrder.OrderItemResources.returnOrderItem", + "azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations.begin_return_order_item": "Microsoft.EdgeOrder.OrderItemResources.returnOrderItem", + "azure.mgmt.edgeorder.operations.OrderResourcesOperations.get": "Microsoft.EdgeOrder.OrderResources.get", + "azure.mgmt.edgeorder.aio.operations.OrderResourcesOperations.get": "Microsoft.EdgeOrder.OrderResources.get", + "azure.mgmt.edgeorder.operations.ProductsAndConfigurationsOperationGroupOperations.list_configurations": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listConfigurations", + "azure.mgmt.edgeorder.aio.operations.ProductsAndConfigurationsOperationGroupOperations.list_configurations": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listConfigurations", + "azure.mgmt.edgeorder.operations.ProductsAndConfigurationsOperationGroupOperations.list_product_families": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listProductFamilies", + "azure.mgmt.edgeorder.aio.operations.ProductsAndConfigurationsOperationGroupOperations.list_product_families": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listProductFamilies", + "azure.mgmt.edgeorder.operations.ProductsAndConfigurationsOperationGroupOperations.list_product_families_metadata": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listProductFamiliesMetadata", + "azure.mgmt.edgeorder.aio.operations.ProductsAndConfigurationsOperationGroupOperations.list_product_families_metadata": "Microsoft.EdgeOrder.ProductsAndConfigurationsOperationGroup.listProductFamiliesMetadata", + "azure.mgmt.edgeorder.operations.OrdersOperationGroupOperations.list_by_subscription": "Microsoft.EdgeOrder.OrdersOperationGroup.listBySubscription", + "azure.mgmt.edgeorder.aio.operations.OrdersOperationGroupOperations.list_by_subscription": "Microsoft.EdgeOrder.OrdersOperationGroup.listBySubscription", + "azure.mgmt.edgeorder.operations.OrdersOperationGroupOperations.list_by_resource_group": "Microsoft.EdgeOrder.OrdersOperationGroup.listByResourceGroup", + "azure.mgmt.edgeorder.aio.operations.OrdersOperationGroupOperations.list_by_resource_group": "Microsoft.EdgeOrder.OrdersOperationGroup.listByResourceGroup" + } +} \ No newline at end of file diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/__init__.py index cf345f5e5ed1..4bd847ad77e1 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/__init__.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/__init__.py @@ -2,25 +2,31 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._edge_order_management_client import EdgeOrderManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import EdgeOrderClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "EdgeOrderManagementClient", + "EdgeOrderClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_client.py new file mode 100644 index 000000000000..cea238f6cb27 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_client.py @@ -0,0 +1,154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from ._configuration import EdgeOrderClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ( + AddressResourcesOperations, + Operations, + OrderItemResourcesOperations, + OrderResourcesOperations, + OrdersOperationGroupOperations, + ProductsAndConfigurationsOperationGroupOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class EdgeOrderClient: + """Edge Order API's. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.edgeorder.operations.Operations + :ivar address_resources: AddressResourcesOperations operations + :vartype address_resources: azure.mgmt.edgeorder.operations.AddressResourcesOperations + :ivar order_item_resources: OrderItemResourcesOperations operations + :vartype order_item_resources: azure.mgmt.edgeorder.operations.OrderItemResourcesOperations + :ivar order_resources: OrderResourcesOperations operations + :vartype order_resources: azure.mgmt.edgeorder.operations.OrderResourcesOperations + :ivar products_and_configurations_operation_group: + ProductsAndConfigurationsOperationGroupOperations operations + :vartype products_and_configurations_operation_group: + azure.mgmt.edgeorder.operations.ProductsAndConfigurationsOperationGroupOperations + :ivar orders_operation_group: OrdersOperationGroupOperations operations + :vartype orders_operation_group: azure.mgmt.edgeorder.operations.OrdersOperationGroupOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-02-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = EdgeOrderClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.address_resources = AddressResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.order_item_resources = OrderItemResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.order_resources = OrderResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products_and_configurations_operation_group = ProductsAndConfigurationsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.orders_operation_group = OrdersOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_configuration.py index 1c28307f38a0..ac4e89a372c1 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,27 +14,34 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class EdgeOrderManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EdgeOrderManagementClient. +class EdgeOrderClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for EdgeOrderClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-02-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-12-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-edgeorder/{}".format(VERSION)) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py deleted file mode 100644 index 9c115640d3b2..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_edge_order_management_client.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from ._configuration import EdgeOrderManagementClientConfiguration -from ._serialization import Deserializer, Serializer -from .operations import EdgeOrderManagementClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class EdgeOrderManagementClient( - EdgeOrderManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """The EdgeOrder Client. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = EdgeOrderManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_patch.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_patch.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/model_base.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/model_base.py new file mode 100644 index 000000000000..49d5c7259389 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/model_base.py @@ -0,0 +1,1232 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/serialization.py similarity index 83% rename from sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py rename to sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/serialization.py index 8139854b97bb..eb86ea23c965 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_serialization.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -426,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -728,21 +708,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1720,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1743,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1834,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1849,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1877,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1887,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1910,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1924,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1976,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1996,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/utils.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/utils.py new file mode 100644 index 000000000000..cbaa624660e4 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_utils/utils.py @@ -0,0 +1,40 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Optional + +from azure.core import MatchConditions + + +def quote_etag(etag: Optional[str]) -> Optional[str]: + if not etag or etag == "*": + return etag + if etag.startswith("W/"): + return etag + if etag.startswith('"') and etag.endswith('"'): + return etag + if etag.startswith("'") and etag.endswith("'"): + return etag + return '"' + etag + '"' + + +def prep_if_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfNotModified: + if_match = quote_etag(etag) if etag else None + return if_match + if match_condition == MatchConditions.IfPresent: + return "*" + return None + + +def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchConditions]) -> Optional[str]: + if match_condition == MatchConditions.IfModified: + if_none_match = quote_etag(etag) if etag else None + return if_none_match + if match_condition == MatchConditions.IfMissing: + return "*" + return None diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_vendor.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_vendor.py deleted file mode 100644 index 97de9394b7bd..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EdgeOrderManagementClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -class EdgeOrderManagementClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: EdgeOrderManagementClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_version.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_version.py index 48944bf3938a..be71c81bd282 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_version.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/_version.py @@ -2,8 +2,8 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/__init__.py index b9eec9b0ea44..3f6c7e24451d 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/__init__.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/__init__.py @@ -2,22 +2,28 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._edge_order_management_client import EdgeOrderManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import EdgeOrderClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "EdgeOrderManagementClient", + "EdgeOrderClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_client.py new file mode 100644 index 000000000000..73c9af2a5241 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_client.py @@ -0,0 +1,159 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .._utils.serialization import Deserializer, Serializer +from ._configuration import EdgeOrderClientConfiguration +from .operations import ( + AddressResourcesOperations, + Operations, + OrderItemResourcesOperations, + OrderResourcesOperations, + OrdersOperationGroupOperations, + ProductsAndConfigurationsOperationGroupOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class EdgeOrderClient: + """Edge Order API's. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.edgeorder.aio.operations.Operations + :ivar address_resources: AddressResourcesOperations operations + :vartype address_resources: azure.mgmt.edgeorder.aio.operations.AddressResourcesOperations + :ivar order_item_resources: OrderItemResourcesOperations operations + :vartype order_item_resources: azure.mgmt.edgeorder.aio.operations.OrderItemResourcesOperations + :ivar order_resources: OrderResourcesOperations operations + :vartype order_resources: azure.mgmt.edgeorder.aio.operations.OrderResourcesOperations + :ivar products_and_configurations_operation_group: + ProductsAndConfigurationsOperationGroupOperations operations + :vartype products_and_configurations_operation_group: + azure.mgmt.edgeorder.aio.operations.ProductsAndConfigurationsOperationGroupOperations + :ivar orders_operation_group: OrdersOperationGroupOperations operations + :vartype orders_operation_group: + azure.mgmt.edgeorder.aio.operations.OrdersOperationGroupOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-02-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = EdgeOrderClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.address_resources = AddressResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.order_item_resources = OrderItemResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.order_resources = OrderResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products_and_configurations_operation_group = ProductsAndConfigurationsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.orders_operation_group = OrdersOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_configuration.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_configuration.py index 5adb2abf8fd7..90295047c7b4 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_configuration.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,27 +14,34 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class EdgeOrderManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EdgeOrderManagementClient. +class EdgeOrderClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for EdgeOrderClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-02-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2021-12-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +50,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-edgeorder/{}".format(VERSION)) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py deleted file mode 100644 index e38b3d3a311c..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_edge_order_management_client.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import EdgeOrderManagementClientConfiguration -from .operations import EdgeOrderManagementClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class EdgeOrderManagementClient( - EdgeOrderManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """The EdgeOrder Client. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = EdgeOrderManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_patch.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_patch.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_vendor.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_vendor.py deleted file mode 100644 index ed13e1b40b7d..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EdgeOrderManagementClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class EdgeOrderManagementClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: EdgeOrderManagementClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/__init__.py index 9e856f64458f..53d9e1a63168 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/__init__.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/__init__.py @@ -2,18 +2,34 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._edge_order_management_client_operations import EdgeOrderManagementClientOperationsMixin +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import AddressResourcesOperations # type: ignore +from ._operations import OrderItemResourcesOperations # type: ignore +from ._operations import OrderResourcesOperations # type: ignore +from ._operations import ProductsAndConfigurationsOperationGroupOperations # type: ignore +from ._operations import OrdersOperationGroupOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "EdgeOrderManagementClientOperationsMixin", + "Operations", + "AddressResourcesOperations", + "OrderItemResourcesOperations", + "OrderResourcesOperations", + "ProductsAndConfigurationsOperationGroupOperations", + "OrdersOperationGroupOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_operations.py similarity index 55% rename from sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_edge_order_management_client_operations.py rename to sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_operations.py index 0bfa17afc009..d53a302ac3e7 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_operations.py @@ -1,21 +1,24 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import json +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient, MatchConditions from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, StreamClosedError, @@ -32,58 +35,69 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ...operations._edge_order_management_client_operations import ( - build_cancel_order_item_request, - build_create_address_request, - build_create_order_item_request, - build_delete_address_by_name_request, - build_delete_order_item_by_name_request, - build_get_address_by_name_request, - build_get_order_by_name_request, - build_get_order_item_by_name_request, - build_list_addresses_at_resource_group_level_request, - build_list_addresses_at_subscription_level_request, - build_list_configurations_request, - build_list_operations_request, - build_list_order_at_resource_group_level_request, - build_list_order_at_subscription_level_request, - build_list_order_items_at_resource_group_level_request, - build_list_order_items_at_subscription_level_request, - build_list_product_families_metadata_request, - build_list_product_families_request, - build_return_order_item_request, - build_update_address_request, - build_update_order_item_request, +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_address_resources_create_request, + build_address_resources_delete_request, + build_address_resources_get_request, + build_address_resources_list_by_resource_group_request, + build_address_resources_list_by_subscription_request, + build_address_resources_update_request, + build_operations_list_request, + build_order_item_resources_cancel_request, + build_order_item_resources_create_request, + build_order_item_resources_delete_request, + build_order_item_resources_get_request, + build_order_item_resources_list_by_resource_group_request, + build_order_item_resources_list_by_subscription_request, + build_order_item_resources_return_order_item_request, + build_order_item_resources_update_request, + build_order_resources_get_request, + build_orders_operation_group_list_by_resource_group_request, + build_orders_operation_group_list_by_subscription_request, + build_products_and_configurations_operation_group_list_configurations_request, + build_products_and_configurations_operation_group_list_product_families_metadata_request, + build_products_and_configurations_operation_group_list_product_families_request, ) -from .._vendor import EdgeOrderManagementClientMixinABC +from .._configuration import EdgeOrderClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] -class EdgeOrderManagementClientOperationsMixin( # pylint: disable=too-many-public-methods - EdgeOrderManagementClientMixinABC -): +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """This method gets all the operations that are exposed for customer. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,12 +108,17 @@ def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_operations_request( - api_version=api_version, + _request = build_operations_list_request( + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -114,58 +133,74 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_addresses_at_subscription_level( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AddressResource"]: - """Lists all the addresses available under the subscription. - :param filter: $filter is supported to filter based on shipping address properties. Filter - supports only equals operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on Get list of addresses, which provides the next - page in the list of addresses. Default value is None. - :type skip_token: str - :return: An iterator like instance of either AddressResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.AddressResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) +class AddressResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`address_resources` attribute. + """ - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - error_map: MutableMapping[int, Type[HttpResponseError]] = { + @distributed_trace_async + async def get(self, resource_group_name: str, address_name: str, **kwargs: Any) -> _models.AddressResource: + """Get information about the specified address. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :return: AddressResource. The AddressResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.AddressResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,473 +208,571 @@ def list_addresses_at_subscription_level( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_addresses_at_subscription_level_request( - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AddressResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_address_resources_get_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return AsyncItemPaged(get_next, extract_data) + response = pipeline_response.http_response - @overload - def list_product_families( - self, - product_families_request: _models.ProductFamiliesRequest, - expand: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :param product_families_request: Filters for showing the product families. Required. - :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AddressResource, response.json()) - @overload - def list_product_families( - self, - product_families_request: IO[bytes], - expand: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param product_families_request: Filters for showing the product families. Required. - :type product_families_request: IO[bytes] - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @distributed_trace - def list_product_families( + async def _create_initial( self, - product_families_request: Union[_models.ProductFamiliesRequest, IO[bytes]], - expand: Optional[str] = None, - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: Union[_models.AddressResource, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncIterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. - - :param product_families_request: Filters for showing the product families. Is either a - ProductFamiliesRequest type or a IO[bytes] type. Required. - :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest or - IO[bytes] - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" - _json = None _content = None - if isinstance(product_families_request, (IOBase, bytes)): - _content = product_families_request + if isinstance(address_resource, (IOBase, bytes)): + _content = address_resource else: - _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") - - def prepare_request(next_link=None): - if not next_link: + _content = json.dumps(address_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_list_product_families_request( - subscription_id=self._config.subscription_id, - expand=expand, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _request = build_address_resources_create_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProductFamilies", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @overload - def list_configurations( + async def begin_create( self, - configurations_request: _models.ConfigurationsRequest, - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: _models.AddressResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> AsyncLROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Required. - :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def list_configurations( + async def begin_create( self, - configurations_request: IO[bytes], - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> AsyncLROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Required. - :type configurations_request: IO[bytes] - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace - def list_configurations( + @overload + async def begin_create( self, - configurations_request: Union[_models.ConfigurationsRequest, IO[bytes]], - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> AsyncLROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Is either a - ConfigurationsRequest type or a IO[bytes] type. Required. - :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest or IO[bytes] - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + address_name: str, + address_resource: Union[_models.AddressResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Is one of the following types: + AddressResource, JSON, IO[bytes] Required. + :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + address_name=address_name, + address_resource=address_resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _update_initial( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: Union[_models.AddressUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" - _json = None _content = None - if isinstance(configurations_request, (IOBase, bytes)): - _content = configurations_request + if isinstance(address_update_parameter, (IOBase, bytes)): + _content = address_update_parameter else: - _json = self._serialize.body(configurations_request, "ConfigurationsRequest") + _content = json.dumps(address_update_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_configurations_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _request = build_address_resources_update_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = self._deserialize("Configurations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def list_product_families_metadata( - self, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ProductFamiliesMetadataDetails"]: - """This method provides the list of product families metadata for the given subscription. + @overload + async def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: _models.AddressUpdateParameter, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AddressResource]: + """Update the properties of an existing address. - :param skip_token: $skipToken is supported on list of product families metadata, which provides - the next page in the list of product families metadata. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProductFamiliesMetadataDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - _request = build_list_product_families_metadata_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + @overload + async def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AddressResource]: + """Update the properties of an existing address. - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProductFamiliesMetadata", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def get_next(next_link=None): - _request = prepare_request(next_link) + @overload + async def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AddressResource]: + """Update the properties of an existing address. - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: Union[_models.AddressUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AddressResource]: + """Update the properties of an existing address. - return pipeline_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Is one of the + following types: AddressUpdateParameter, JSON, IO[bytes] Required. + :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - return AsyncItemPaged(get_next, extract_data) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + address_name=address_name, + address_update_parameter=address_update_parameter, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - @distributed_trace - def list_order_at_subscription_level( - self, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.OrderResource"]: - """Lists order at subscription level. + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AddressResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - :param skip_token: $skipToken is supported on Get list of order, which provides the next page - in the list of order. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AddressResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AddressResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _delete_initial(self, resource_group_name: str, address_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,93 +780,145 @@ def list_order_at_subscription_level( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_list_order_at_subscription_level_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_address_resources_delete_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = self._deserialize("OrderResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, address_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete an address. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + address_name=address_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_order_items_at_subscription_level( + def list_by_resource_group( self, + resource_group_name: str, + *, filter: Optional[str] = None, - expand: Optional[str] = None, skip_token: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.OrderItemResource"]: - """Lists order item at subscription level. - - :param filter: $filter is supported to filter based on order id. Filter supports only equals - operation. Default value is None. - :type filter: str - :param expand: $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. Default value is - None. - :type expand: str - :param skip_token: $skipToken is supported on Get list of order items, which provides the next - page in the list of order items. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderItemResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] + ) -> AsyncIterable["_models.AddressResource"]: + """List all the addresses available under the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword filter: $filter is supported to filter based on shipping address properties. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword skip_token: $skipToken is supported on Get list of addresses, which provides the next + page in the list of addresses. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of AddressResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AddressResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,16 +929,22 @@ def list_order_items_at_subscription_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_items_at_subscription_level_request( + _request = build_address_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, - expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -768,29 +959,34 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OrderItemResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AddressResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -798,31 +994,35 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_addresses_at_resource_group_level( - self, resource_group_name: str, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any + def list_by_subscription( + self, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> AsyncIterable["_models.AddressResource"]: - """Lists all the addresses available under the given resource group. + """List all the addresses available under the subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: $filter is supported to filter based on shipping address properties. Filter + :keyword filter: $filter is supported to filter based on shipping address properties. Filter supports only equals operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on Get list of addresses, which provides the next - page in the list of address. Default value is None. - :type skip_token: str - :return: An iterator like instance of either AddressResource or the result of cls(response) + :paramtype filter: str + :keyword skip_token: $skipToken is supported on Get list of addresses, which provides the next + page in the list of addresses. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of AddressResource :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AddressResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -833,16 +1033,21 @@ def list_addresses_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_addresses_at_resource_group_level_request( - resource_group_name=resource_group_name, + _request = build_address_resources_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -857,53 +1062,81 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("AddressResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AddressResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + +class OrderItemResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`order_item_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async - async def get_address_by_name( - self, address_name: str, resource_group_name: str, **kwargs: Any - ) -> _models.AddressResource: - """Gets information about the specified address. + async def get( + self, resource_group_name: str, order_item_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.OrderItemResource: + """Get an order item. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: AddressResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.AddressResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :return: OrderItemResource. The OrderItemResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.OrderItemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,48 +1145,59 @@ async def get_address_by_name( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) - _request = build_get_address_by_name_request( - address_name=address_name, + _request = build_order_item_resources_get_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, + expand=expand, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OrderItemResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_address_initial( + async def _create_initial( self, - address_name: str, resource_group_name: str, - address_resource: Union[_models.AddressResource, IO[bytes]], + order_item_name: str, + order_item_resource: Union[_models.OrderItemResource, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -962,36 +1206,35 @@ async def _create_address_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None - if isinstance(address_resource, (IOBase, bytes)): - _content = address_resource + if isinstance(order_item_resource, (IOBase, bytes)): + _content = order_item_resource else: - _json = self._serialize.body(address_resource, "AddressResource") + _content = json.dumps(order_item_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_create_address_request( - address_name=address_name, + _request = build_order_item_resources_create_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1003,119 +1246,145 @@ async def _create_address_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_address( + async def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: _models.AddressResource, + order_item_name: str, + order_item_resource: _models.OrderItemResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> AsyncLROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Required. - :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_address( + async def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: IO[bytes], + order_item_name: str, + order_item_resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> AsyncLROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Required. - :type address_resource: IO[bytes] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + order_item_name: str, + order_item_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item + API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_address( + async def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: Union[_models.AddressResource, IO[bytes]], + order_item_name: str, + order_item_resource: Union[_models.OrderItemResource, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> AsyncLROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Is either a AddressResource type or - a IO[bytes] type. Required. - :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Is one of the following + types: OrderItemResource, JSON, IO[bytes] Required. + :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_address_initial( - address_name=address_name, + raw_result = await self._create_initial( resource_group_name=resource_group_name, - address_resource=address_resource, - api_version=api_version, + order_item_name=order_item_name, + order_item_resource=order_item_resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -1125,110 +1394,266 @@ async def begin_create_address( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AddressResource].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AddressResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_address_by_name_initial( - self, address_name: str, resource_group_name: str, **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: Union[_models.OrderItemUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_address_by_name_request( - address_name=address_name, + content_type = content_type or "application/json" + _content = None + if isinstance(order_item_update_parameter, (IOBase, bytes)): + _content = order_item_update_parameter + else: + _content = json.dumps(order_item_update_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_order_item_resources_update_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: _models.OrderItemUpdateParameter, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete_address_by_name( - self, address_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an address. + async def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: Union[_models.OrderItemUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Is one of + the following types: OrderItemUpdateParameter, JSON, IO[bytes] Required. + :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of AsyncLROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_address_by_name_initial( - address_name=address_name, + raw_result = await self._update_initial( resource_group_name=resource_group_name, - api_version=api_version, + order_item_name=order_item_name, + order_item_update_parameter=order_item_update_parameter, + etag=etag, + match_condition=match_condition, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1237,34 +1662,40 @@ async def begin_delete_address_by_name( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OrderItemResource, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.OrderItemResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.OrderItemResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_address_initial( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: Union[_models.AddressUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, order_item_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1272,174 +1703,76 @@ async def _update_address_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(address_update_parameter, (IOBase, bytes)): - _content = address_update_parameter - else: - _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") - - _request = build_update_address_request( - address_name=address_name, + _request = build_order_item_resources_delete_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - - @overload - async def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: _models.AddressUpdateParameter, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Updates the properties of an existing address. - - :param address_name: 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. Required. - :type address_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Required. - :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Updates the properties of an existing address. - - :param address_name: 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. Required. - :type address_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Required. - :type address_update_parameter: IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: Union[_models.AddressUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.AddressResource]: - """Updates the properties of an existing address. - - :param address_name: 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. Required. - :type address_name: str + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, order_item_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete an order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Is either a - AddressUpdateParameter type or a IO[bytes] type. Required. - :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter or - IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_address_initial( - address_name=address_name, + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - address_update_parameter=address_update_parameter, - if_match=if_match, - api_version=api_version, - content_type=content_type, + order_item_name=order_item_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1448,52 +1781,73 @@ async def begin_update_address( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AddressResource].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AddressResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_order_at_resource_group_level( - self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.OrderResource"]: - """Lists order at resource group level. + def list_by_resource_group( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.OrderItemResource"]: + """List order items at resource group level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param skip_token: $skipToken is supported on Get list of order, which provides the next page - in the list of order. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderResource] + :keyword filter: $filter is supported to filter based on order id and order Item Type. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on Get list of order items, which provides the + next page in the list of order items. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderItemResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OrderItemResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1504,15 +1858,23 @@ def list_order_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_at_resource_group_level_request( + _request = build_order_item_resources_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1527,133 +1889,78 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OrderResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderItemResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_order_by_name( - self, order_name: str, resource_group_name: str, location: str, **kwargs: Any - ) -> _models.OrderResource: - """Gets an order. - - :param order_name: The name of the order. Required. - :type order_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :return: OrderResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.OrderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) - - _request = build_get_order_by_name_request( - order_name=order_name, - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OrderResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace - def list_order_items_at_resource_group_level( + def list_by_subscription( self, - resource_group_name: str, + *, filter: Optional[str] = None, expand: Optional[str] = None, skip_token: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.OrderItemResource"]: - """Lists order item at resource group level. + """List order items at subscription level. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: $filter is supported to filter based on order id. Filter supports only equals - operation. Default value is None. - :type filter: str - :param expand: $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. Default value is - None. - :type expand: str - :param skip_token: $skipToken is supported on Get list of order items, which provides the next - page in the list of order items. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderItemResource or the result of cls(response) + :keyword filter: $filter is supported to filter based on order id and order Item Type. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on Get list of order items, which provides the + next page in the list of order items. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderItemResource :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OrderItemResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1664,17 +1971,22 @@ def list_order_items_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_items_at_resource_group_level_request( - resource_group_name=resource_group_name, + _request = build_order_item_resources_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1689,57 +2001,144 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OrderItemResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderItemResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_order_item_by_name( - self, order_item_name: str, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> _models.OrderItemResource: - """Gets an order item. + @overload + async def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :param order_item_name: The name of the order item. Required. :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: Union[_models.CancellationReason, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Cancel order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param expand: $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. Default value is - None. - :type expand: str - :return: OrderItemResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.OrderItemResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Is one of the following types: + CancellationReason, JSON, IO[bytes] Required. + :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason or JSON or IO[bytes] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,50 +2146,57 @@ async def get_order_item_by_name( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_get_order_item_by_name_request( - order_item_name=order_item_name, + content_type = content_type or "application/json" + _content = None + if isinstance(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _content = json.dumps(cancellation_reason, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_order_item_resources_cancel_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - async def _create_order_item_initial( + async def _return_order_item_initial( self, - order_item_name: str, resource_group_name: str, - order_item_resource: Union[_models.OrderItemResource, IO[bytes]], + order_item_name: str, + return_order_item_details: Union[_models.ReturnOrderItemDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1799,36 +2205,35 @@ async def _create_order_item_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None - if isinstance(order_item_resource, (IOBase, bytes)): - _content = order_item_resource + if isinstance(return_order_item_details, (IOBase, bytes)): + _content = return_order_item_details else: - _json = self._serialize.body(order_item_resource, "OrderItemResource") + _content = json.dumps(return_order_item_details, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_create_order_item_request( - order_item_name=order_item_name, + _request = build_order_item_resources_return_order_item_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1840,113 +2245,142 @@ async def _create_order_item_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_order_item( + async def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: _models.OrderItemResource, + order_item_name: str, + return_order_item_details: _models.ReturnOrderItemDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> AsyncLROPoller[_models.OkResponse]: + """Return order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :param order_item_name: The name of the order item. Required. :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_return_order_item( + self, + resource_group_name: str, + order_item_name: str, + return_order_item_details: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OkResponse]: + """Return order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Required. - :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_order_item( + async def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: IO[bytes], + order_item_name: str, + return_order_item_details: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> AsyncLROPoller[_models.OkResponse]: + """Return order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Required. - :type order_item_resource: IO[bytes] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_order_item( + async def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: Union[_models.OrderItemResource, IO[bytes]], + order_item_name: str, + return_order_item_details: Union[_models.ReturnOrderItemDetails, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> AsyncLROPoller[_models.OkResponse]: + """Return order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Is either a OrderItemResource - type or a IO[bytes] type. Required. - :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Is one of the following types: + ReturnOrderItemDetails, JSON, IO[bytes] Required. + :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OkResponse. The OkResponse is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_order_item_initial( - order_item_name=order_item_name, + raw_result = await self._return_order_item_initial( resource_group_name=resource_group_name, - order_item_resource=order_item_resource, - api_version=api_version, + order_item_name=order_item_name, + return_order_item_details=return_order_item_details, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -1957,32 +2391,75 @@ async def begin_create_order_item( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OrderItemResource].from_continuation_token( + return AsyncLROPoller[_models.OkResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OrderItemResource]( + return AsyncLROPoller[_models.OkResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_order_item_by_name_initial( - self, order_item_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + +class OrderResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`order_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, location: str, order_name: str, **kwargs: Any + ) -> _models.OrderResource: + """Get an order. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param order_name: The name of the order. Required. + :type order_name: str + :return: OrderResource. The OrderResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.OrderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1991,386 +2468,468 @@ async def _delete_order_item_by_name_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) - _request = build_delete_order_item_by_name_request( - order_item_name=order_item_name, + _request = build_order_resources_get_request( resource_group_name=resource_group_name, + location=location, + order_name=order_name, subscription_id=self._config.subscription_id, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OrderResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete_order_item_by_name( - self, order_item_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] +class ProductsAndConfigurationsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`products_and_configurations_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list_configurations( + self, + configurations_request: _models.ConfigurationsRequest, + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_order_item_by_name_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + @overload + def list_configurations( + self, + configurations_request: JSON, + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: JSON + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @overload + def list_configurations( + self, + configurations_request: IO[bytes], + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: IO[bytes] + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ - async def _update_order_item_initial( + @distributed_trace + def list_configurations( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: Union[_models.OrderItemUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, + configurations_request: Union[_models.ConfigurationsRequest, JSON, IO[bytes]], + *, + skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Is one of the following + types: ConfigurationsRequest, JSON, IO[bytes] Required. + :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest or JSON or + IO[bytes] + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.Configuration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None _content = None - if isinstance(order_item_update_parameter, (IOBase, bytes)): - _content = order_item_update_parameter + if isinstance(configurations_request, (IOBase, bytes)): + _content = configurations_request else: - _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") + _content = json.dumps(configurations_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_update_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def prepare_request(next_link=None): + if not next_link: - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _request = build_products_and_configurations_operation_group_list_configurations_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return _request - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Configuration], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + def list_product_families( + self, + product_families_request: _models.ProductFamiliesRequest, + *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.ProductFamily"]: + """List product families for the given subscription. - return deserialized # type: ignore + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload - async def begin_update_order_item( + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: _models.OrderItemUpdateParameter, - if_match: Optional[str] = None, + product_families_request: JSON, *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> AsyncIterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Required. - :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: JSON + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_order_item( + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: IO[bytes], - if_match: Optional[str] = None, + product_families_request: IO[bytes], *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> AsyncIterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Required. - :type order_item_update_parameter: IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: IO[bytes] + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async - async def begin_update_order_item( + @distributed_trace + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: Union[_models.OrderItemUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, + product_families_request: Union[_models.ProductFamiliesRequest, JSON, IO[bytes]], + *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> AsyncIterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Is either a - OrderItemUpdateParameter type or a IO[bytes] type. Required. - :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter or + :param product_families_request: Filters for showing the product families. Is one of the + following types: ProductFamiliesRequest, JSON, IO[bytes] Required. + :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest or JSON or IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_order_item_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - order_item_update_parameter=order_item_update_parameter, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.ProductFamily]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(product_families_request, (IOBase, bytes)): + _content = product_families_request + else: + _content = json.dumps(product_families_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_and_configurations_operation_group_list_product_families_request( + subscription_id=self._config.subscription_id, + expand=expand, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProductFamily], deserialized.get("value", [])) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OrderItemResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.OrderItemResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - @overload - async def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: _models.CancellationReason, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Cancel order item. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Required. - :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + return pipeline_response - @overload - async def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Cancel order item. + return AsyncItemPaged(get_next, extract_data) - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Required. - :type cancellation_reason: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + @distributed_trace + def list_product_families_metadata( + self, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ProductFamiliesMetadataDetails"]: + """List product families metadata for the given subscription. + + :keyword skip_token: $skipToken is supported on list of product families metadata, which + provides the next page in the list of product families metadata. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProductFamiliesMetadataDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace_async - async def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: Union[_models.CancellationReason, IO[bytes]], - **kwargs: Any - ) -> None: - """Cancel order item. + cls: ClsType[List[_models.ProductFamiliesMetadataDetails]] = kwargs.pop("cls", None) - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a - IO[bytes] type. Required. - :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason or IO[bytes] - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2378,57 +2937,110 @@ async def cancel_order_item( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_and_configurations_operation_group_list_product_families_metadata_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProductFamiliesMetadataDetails], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cancellation_reason, (IOBase, bytes)): - _content = cancellation_reason - else: - _json = self._serialize.body(cancellation_reason, "CancellationReason") + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _request = build_cancel_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + return pipeline_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return AsyncItemPaged(get_next, extract_data) - response = pipeline_response.http_response - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) +class OrdersOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, None, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.aio.EdgeOrderClient`'s + :attr:`orders_operation_group` attribute. + """ - async def _return_order_item_initial( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: Union[_models.ReturnOrderItemDetails, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription( + self, *, skip_token: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.OrderResource"]: + """List orders at subscription level. + + :keyword skip_token: $skipToken is supported on Get list of orders, which provides the next + page in the list of orders. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OrderResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2436,174 +3048,165 @@ async def _return_order_item_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_orders_operation_group_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(return_order_item_details, (IOBase, bytes)): - _content = return_order_item_details - else: - _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_return_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @overload - async def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: _models.ReturnOrderItemDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Return order item. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, skip_token: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.OrderResource"]: + """List orders at resource group level. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Required. - :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :keyword skip_token: $skipToken is supported on Get list of orders, which provides the next + page in the list of orders. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.edgeorder.models.OrderResource] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Return order item. + cls: ClsType[List[_models.OrderResource]] = kwargs.pop("cls", None) - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Required. - :type return_order_item_details: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: Union[_models.ReturnOrderItemDetails, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Return order item. + def prepare_request(next_link=None): + if not next_link: - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Is either a - ReturnOrderItemDetails type or a IO[bytes] type. Required. - :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _request = build_orders_operation_group_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._return_order_item_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - return_order_item_details=return_order_item_details, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderResource], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_patch.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_patch.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/__init__.py index d3d9ea404673..5faa265e21d0 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/__init__.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/__init__.py @@ -2,126 +2,165 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AddressDetails -from ._models_py3 import AddressProperties -from ._models_py3 import AddressResource -from ._models_py3 import AddressResourceList -from ._models_py3 import AddressUpdateParameter -from ._models_py3 import AvailabilityInformation -from ._models_py3 import BasicInformation -from ._models_py3 import BillingMeterDetails -from ._models_py3 import CancellationReason -from ._models_py3 import CommonProperties -from ._models_py3 import Configuration -from ._models_py3 import ConfigurationFilters -from ._models_py3 import ConfigurationProperties -from ._models_py3 import Configurations -from ._models_py3 import ConfigurationsRequest -from ._models_py3 import ContactDetails -from ._models_py3 import CostInformation -from ._models_py3 import CustomerSubscriptionDetails -from ._models_py3 import CustomerSubscriptionRegisteredFeatures -from ._models_py3 import Description -from ._models_py3 import DeviceDetails -from ._models_py3 import Dimensions -from ._models_py3 import DisplayInfo -from ._models_py3 import EncryptionPreferences -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import FilterableProperty -from ._models_py3 import ForwardShippingDetails -from ._models_py3 import HierarchyInformation -from ._models_py3 import ImageInformation -from ._models_py3 import Link -from ._models_py3 import ManagementResourcePreferences -from ._models_py3 import MeterDetails -from ._models_py3 import NotificationPreference -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OrderItemDetails -from ._models_py3 import OrderItemResource -from ._models_py3 import OrderItemResourceList -from ._models_py3 import OrderItemUpdateParameter -from ._models_py3 import OrderResource -from ._models_py3 import OrderResourceList -from ._models_py3 import Pav2MeterDetails -from ._models_py3 import Preferences -from ._models_py3 import Product -from ._models_py3 import ProductDetails -from ._models_py3 import ProductFamilies -from ._models_py3 import ProductFamiliesMetadata -from ._models_py3 import ProductFamiliesMetadataDetails -from ._models_py3 import ProductFamiliesRequest -from ._models_py3 import ProductFamily -from ._models_py3 import ProductFamilyProperties -from ._models_py3 import ProductLine -from ._models_py3 import ProductLineProperties -from ._models_py3 import ProductProperties -from ._models_py3 import ProxyResource -from ._models_py3 import PurchaseMeterDetails -from ._models_py3 import Resource -from ._models_py3 import ResourceIdentity -from ._models_py3 import ResourceProviderDetails -from ._models_py3 import ReturnOrderItemDetails -from ._models_py3 import ReverseShippingDetails -from ._models_py3 import ShippingAddress -from ._models_py3 import ShippingDetails -from ._models_py3 import Specification -from ._models_py3 import StageDetails -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import TransportPreferences +from typing import TYPE_CHECKING -from ._edge_order_management_client_enums import ActionStatusEnum -from ._edge_order_management_client_enums import ActionType -from ._edge_order_management_client_enums import AddressType -from ._edge_order_management_client_enums import AddressValidationStatus -from ._edge_order_management_client_enums import AvailabilityStage -from ._edge_order_management_client_enums import BillingType -from ._edge_order_management_client_enums import ChargingType -from ._edge_order_management_client_enums import CreatedByType -from ._edge_order_management_client_enums import DescriptionType -from ._edge_order_management_client_enums import DisabledReason -from ._edge_order_management_client_enums import DoubleEncryptionStatus -from ._edge_order_management_client_enums import ImageType -from ._edge_order_management_client_enums import LengthHeightUnit -from ._edge_order_management_client_enums import LinkType -from ._edge_order_management_client_enums import MeteringType -from ._edge_order_management_client_enums import NotificationStageName -from ._edge_order_management_client_enums import OrderItemCancellationEnum -from ._edge_order_management_client_enums import OrderItemReturnEnum -from ._edge_order_management_client_enums import OrderItemType -from ._edge_order_management_client_enums import Origin -from ._edge_order_management_client_enums import StageName -from ._edge_order_management_client_enums import StageStatus -from ._edge_order_management_client_enums import SupportedFilterTypes -from ._edge_order_management_client_enums import TransportShipmentTypes -from ._edge_order_management_client_enums import WeightMeasurementUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AdditionalConfiguration, + AddressDetails, + AddressProperties, + AddressResource, + AddressUpdateParameter, + AddressUpdateProperties, + AvailabilityInformation, + BasicInformation, + BillingMeterDetails, + CancellationReason, + CategoryInformation, + ChildConfiguration, + ChildConfigurationFilter, + ChildConfigurationProperties, + CommonProperties, + Configuration, + ConfigurationDeviceDetails, + ConfigurationFilter, + ConfigurationProperties, + ConfigurationsRequest, + ContactDetails, + CostInformation, + CustomerSubscriptionDetails, + CustomerSubscriptionRegisteredFeatures, + Description, + DeviceDetails, + DevicePresenceVerificationDetails, + Dimensions, + DisplayInfo, + EncryptionPreferences, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FilterableProperty, + ForwardShippingDetails, + GroupedChildConfigurations, + HierarchyInformation, + ImageInformation, + Link, + ManagementResourcePreferences, + MeterDetails, + NotificationPreference, + OkResponse, + Operation, + OperationDisplay, + OrderItemDetails, + OrderItemDetailsUpdateParameter, + OrderItemProperties, + OrderItemResource, + OrderItemUpdateParameter, + OrderItemUpdateProperties, + OrderProperties, + OrderResource, + Pav2MeterDetails, + Preferences, + Product, + ProductDetails, + ProductDetailsUpdateParameter, + ProductFamiliesMetadataDetails, + ProductFamiliesRequest, + ProductFamily, + ProductFamilyProperties, + ProductLine, + ProductLineProperties, + ProductProperties, + ProvisioningDetails, + ProxyResource, + PurchaseMeterDetails, + Resource, + ResourceIdentity, + ResourceProviderDetails, + ReturnOrderItemDetails, + ReverseShippingDetails, + ShippingAddress, + SiteDetails, + Specification, + StageDetails, + SystemData, + TermCommitmentInformation, + TermCommitmentPreferences, + TermTypeDetails, + TrackedResource, + TransportPreferences, + UserAssignedIdentity, +) + +from ._enums import ( # type: ignore + ActionStatusEnum, + ActionType, + AddressClassification, + AddressType, + AddressValidationStatus, + AutoProvisioningStatus, + AvailabilityStage, + BillingType, + ChargingType, + ChildConfigurationType, + CreatedByType, + DescriptionType, + DevicePresenceVerificationStatus, + DisabledReason, + DoubleEncryptionStatus, + FulfillmentType, + IdentificationType, + ImageType, + LengthHeightUnit, + LinkType, + MeteringType, + NotificationStageName, + OrderItemCancellationEnum, + OrderItemReturnEnum, + OrderItemType, + OrderMode, + Origin, + ProvisioningState, + ProvisioningSupport, + StageName, + StageStatus, + SupportedFilterTypes, + TermCommitmentType, + TransportShipmentTypes, + WeightMeasurementUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AdditionalConfiguration", "AddressDetails", "AddressProperties", "AddressResource", - "AddressResourceList", "AddressUpdateParameter", + "AddressUpdateProperties", "AvailabilityInformation", "BasicInformation", "BillingMeterDetails", "CancellationReason", + "CategoryInformation", + "ChildConfiguration", + "ChildConfigurationFilter", + "ChildConfigurationProperties", "CommonProperties", "Configuration", - "ConfigurationFilters", + "ConfigurationDeviceDetails", + "ConfigurationFilter", "ConfigurationProperties", - "Configurations", "ConfigurationsRequest", "ContactDetails", "CostInformation", @@ -129,6 +168,7 @@ "CustomerSubscriptionRegisteredFeatures", "Description", "DeviceDetails", + "DevicePresenceVerificationDetails", "Dimensions", "DisplayInfo", "EncryptionPreferences", @@ -137,27 +177,29 @@ "ErrorResponse", "FilterableProperty", "ForwardShippingDetails", + "GroupedChildConfigurations", "HierarchyInformation", "ImageInformation", "Link", "ManagementResourcePreferences", "MeterDetails", "NotificationPreference", + "OkResponse", "Operation", "OperationDisplay", - "OperationListResult", "OrderItemDetails", + "OrderItemDetailsUpdateParameter", + "OrderItemProperties", "OrderItemResource", - "OrderItemResourceList", "OrderItemUpdateParameter", + "OrderItemUpdateProperties", + "OrderProperties", "OrderResource", - "OrderResourceList", "Pav2MeterDetails", "Preferences", "Product", "ProductDetails", - "ProductFamilies", - "ProductFamiliesMetadata", + "ProductDetailsUpdateParameter", "ProductFamiliesMetadataDetails", "ProductFamiliesRequest", "ProductFamily", @@ -165,6 +207,7 @@ "ProductLine", "ProductLineProperties", "ProductProperties", + "ProvisioningDetails", "ProxyResource", "PurchaseMeterDetails", "Resource", @@ -173,23 +216,33 @@ "ReturnOrderItemDetails", "ReverseShippingDetails", "ShippingAddress", - "ShippingDetails", + "SiteDetails", "Specification", "StageDetails", "SystemData", + "TermCommitmentInformation", + "TermCommitmentPreferences", + "TermTypeDetails", "TrackedResource", "TransportPreferences", + "UserAssignedIdentity", "ActionStatusEnum", "ActionType", + "AddressClassification", "AddressType", "AddressValidationStatus", + "AutoProvisioningStatus", "AvailabilityStage", "BillingType", "ChargingType", + "ChildConfigurationType", "CreatedByType", "DescriptionType", + "DevicePresenceVerificationStatus", "DisabledReason", "DoubleEncryptionStatus", + "FulfillmentType", + "IdentificationType", "ImageType", "LengthHeightUnit", "LinkType", @@ -198,12 +251,16 @@ "OrderItemCancellationEnum", "OrderItemReturnEnum", "OrderItemType", + "OrderMode", "Origin", + "ProvisioningState", + "ProvisioningSupport", "StageName", "StageStatus", "SupportedFilterTypes", + "TermCommitmentType", "TransportShipmentTypes", "WeightMeasurementUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_edge_order_management_client_enums.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_enums.py similarity index 62% rename from sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_edge_order_management_client_enums.py rename to sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_enums.py index e0ba5928071e..2951adfd4841 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_edge_order_management_client_enums.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -20,9 +20,21 @@ class ActionStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class AddressClassification(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of address based on its usage context.""" + + SHIPPING = "Shipping" + """Shipping address for the order.""" + SITE = "Site" + """Site Address.""" class AddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -47,21 +59,33 @@ class AddressValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Address provided is ambiguous, please choose one of the alternate addresses returned.""" +class AutoProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Auto Provisioning Details.""" + + ENABLED = "Enabled" + """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.""" + DISABLED = "Disabled" + """Provisioning Disabled.""" + + class AvailabilityStage(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Current availability stage of the product. Availability stage.""" + """Current availability stage of the product.""" AVAILABLE = "Available" """Product is available.""" - COMING_SOON = "ComingSoon" - """Product is coming soon.""" PREVIEW = "Preview" """Product is in preview.""" - DEPRECATED = "Deprecated" - """Product is deprecated.""" SIGNUP = "Signup" """Product is available only on signup.""" + DISCOVERABLE = "Discoverable" + """Product is not available in our service but can be discovered from other sources.""" + COMING_SOON = "ComingSoon" + """Product is coming soon.""" UNAVAILABLE = "Unavailable" """Product is not available.""" + DEPRECATED = "Deprecated" + """Product is deprecated.""" class BillingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -82,13 +106,26 @@ class ChargingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Per device charging type.""" +class ChildConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ChildConfigurationType.""" + + DEVICE_CONFIGURATION = "DeviceConfiguration" + """Child configuration is a device configuration.""" + ADDITIONAL_CONFIGURATION = "AdditionalConfiguration" + """Child configuration is an additional configuration.""" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class DescriptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -98,6 +135,17 @@ class DescriptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Base description.""" +class DevicePresenceVerificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Proof of possession status.""" + + NOT_INITIATED = "NotInitiated" + """The device has not yet been verified to be with the right edge operator or at the right + location.""" + COMPLETED = "Completed" + """Confirms that the device is verified to be with the right edge operator or at the right + location.""" + + class DisabledReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Reason why the product is disabled.""" @@ -126,9 +174,28 @@ class DoubleEncryptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ DISABLED = "Disabled" - """Double encryption is disabled""" + """Double encryption is disabled.""" ENABLED = "Enabled" - """Double encryption is enabled""" + """Double encryption is enabled.""" + + +class FulfillmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The entity responsible for fulfillment of the item at the given hierarchy level.""" + + MICROSOFT = "Microsoft" + """The fulfillment (the whole journey of the product offering) is handled by microsoft.""" + EXTERNAL = "External" + """The fulfillment (the whole journey of the product offering) is handled by external third party + entities.""" + + +class IdentificationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identification type of the configuration.""" + + NOT_SUPPORTED = "NotSupported" + """Product does not have any explicit identifier.""" + SERIAL_NUMBER = "SerialNumber" + """Product is identifiable by serial number.""" class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -149,8 +216,6 @@ class LengthHeightUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Inch, applicable for West US.""" CM = "CM" """Centimeter.""" - IN_ENUM = "IN" - """Inch, applicable for West US.""" class LinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -163,11 +228,13 @@ class LinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SPECIFICATION = "Specification" """Link to product specification.""" DOCUMENTATION = "Documentation" - """Link to product documentation""" + """Link to product documentation.""" KNOW_MORE = "KnowMore" - """Link to know more""" + """Link to know more.""" SIGN_UP = "SignUp" - """Link to sign up for products""" + """Link to sign up for products.""" + DISCOVERABLE = "Discoverable" + """Link to order the product from another source and not from Azure Edge Hardware Center.""" class MeteringType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -219,6 +286,17 @@ class OrderItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Purchase OrderItem.""" RENTAL = "Rental" """Rental OrderItem.""" + EXTERNAL = "External" + """Orders placed outside of azure.""" + + +class OrderMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the mode of the Order item.""" + + DEFAULT = "Default" + """Default Order mode.""" + DO_NOT_FULFILL = "DoNotFulfill" + """Mode in which the Order will not be fulfilled.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -227,33 +305,60 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state.""" + + CREATING = "Creating" + """Creating state.""" + SUCCEEDED = "Succeeded" + """Succeeded state.""" + FAILED = "Failed" + """Failed state.""" + CANCELED = "Canceled" + """Canceled state.""" + + +class ProvisioningSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determining nature of provisioning that the configuration supports.""" + + CLOUD_BASED = "CloudBased" + """The configuration can be provisioned from the cloud.""" + MANUAL = "Manual" + """The configuration need to be provisioned manually by the end user.""" class StageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Stage name.""" PLACED = "Placed" - """Currently in draft mode and can still be cancelled""" + """Currently in draft mode and can still be cancelled.""" IN_REVIEW = "InReview" - """Order is currently in draft mode and can still be cancelled""" + """Order is currently in draft mode and can still be cancelled.""" CONFIRMED = "Confirmed" - """Order is confirmed""" + """Order is confirmed.""" READY_TO_SHIP = "ReadyToShip" - """Order is ready to ship""" + """Order is ready to ship.""" SHIPPED = "Shipped" - """Order is in transit to customer""" + """Order is in transit to customer.""" DELIVERED = "Delivered" - """Order is delivered to customer""" + """Order is delivered to customer.""" + READY_TO_SETUP = "ReadyToSetup" + """Order is ready to get cloud connected.""" IN_USE = "InUse" - """Order is in use at customer site""" + """Order is in use at customer site.""" RETURN_INITIATED = "ReturnInitiated" """Return has been initiated by customer.""" RETURN_PICKED_UP = "ReturnPickedUp" - """Order is in transit from customer to microsoft.""" + """Order is in transit from customer to Microsoft.""" RETURNED_TO_MICROSOFT = "ReturnedToMicrosoft" - """Order has been received back to microsoft.""" + """Order has been received back to Microsoft.""" RETURN_COMPLETED = "ReturnCompleted" """Return has now completed.""" CANCELLED = "Cancelled" @@ -281,9 +386,20 @@ class SupportedFilterTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of product filter.""" SHIP_TO_COUNTRIES = "ShipToCountries" - """Ship to country""" + """Ship to country.""" DOUBLE_ENCRYPTION_STATUS = "DoubleEncryptionStatus" - """Double encryption status""" + """Double encryption status.""" + + +class TermCommitmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Term Commitment Type.""" + + NONE = "None" + """Pay as you go Term Commitment Model.""" + TRIAL = "Trial" + """Trial Term Commitment Model.""" + TIMED = "Timed" + """Time based Term Commitment Model.""" class TransportShipmentTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models.py new file mode 100644 index 000000000000..df2ed94dd47c --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models.py @@ -0,0 +1,3416 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field +from ._enums import BillingType + +if TYPE_CHECKING: + from .. import models as _models + + +class AdditionalConfiguration(_Model): + """Additional Configuration details. + + :ivar hierarchy_information: Hierarchy of the product which uniquely identifies the + configuration. Required. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar quantity: Quantity of the product. Required. + :vartype quantity: int + :ivar provisioning_details: List Provisioning Details for Devices in Additional Config. + :vartype provisioning_details: list[~azure.mgmt.edgeorder.models.ProvisioningDetails] + """ + + hierarchy_information: "_models.HierarchyInformation" = rest_field( + name="hierarchyInformation", visibility=["read", "create", "update", "delete", "query"] + ) + """Hierarchy of the product which uniquely identifies the configuration. Required.""" + quantity: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Quantity of the product. Required.""" + provisioning_details: Optional[List["_models.ProvisioningDetails"]] = rest_field( + name="provisioningDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """List Provisioning Details for Devices in Additional Config.""" + + @overload + def __init__( + self, + *, + hierarchy_information: "_models.HierarchyInformation", + quantity: int, + provisioning_details: Optional[List["_models.ProvisioningDetails"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AddressDetails(_Model): + """Address details for an order item. + + :ivar forward_address: Customer address and contact details. Required. + :vartype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties + :ivar return_address: Return shipping address. + :vartype return_address: ~azure.mgmt.edgeorder.models.AddressProperties + """ + + forward_address: "_models.AddressProperties" = rest_field( + name="forwardAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer address and contact details. Required.""" + return_address: Optional["_models.AddressProperties"] = rest_field(name="returnAddress", visibility=["read"]) + """Return shipping address.""" + + @overload + def __init__( + self, + *, + forward_address: "_models.AddressProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AddressProperties(_Model): + """Address Properties. + + :ivar address_classification: Type of address based on its usage context. Known values are: + "Shipping" and "Site". + :vartype address_classification: str or ~azure.mgmt.edgeorder.models.AddressClassification + :ivar shipping_address: Shipping details for the address. + :vartype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress + :ivar contact_details: Contact details for the address. + :vartype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails + :ivar address_validation_status: Status of address validation. Known values are: "Valid", + "Invalid", and "Ambiguous". + :vartype address_validation_status: str or ~azure.mgmt.edgeorder.models.AddressValidationStatus + :ivar provisioning_state: Provisioning state. Known values are: "Creating", "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.edgeorder.models.ProvisioningState + """ + + address_classification: Optional[Union[str, "_models.AddressClassification"]] = rest_field( + name="addressClassification", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of address based on its usage context. Known values are: \"Shipping\" and \"Site\".""" + shipping_address: Optional["_models.ShippingAddress"] = rest_field( + name="shippingAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Shipping details for the address.""" + contact_details: Optional["_models.ContactDetails"] = rest_field( + name="contactDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contact details for the address.""" + address_validation_status: Optional[Union[str, "_models.AddressValidationStatus"]] = rest_field( + name="addressValidationStatus", visibility=["read"] + ) + """Status of address validation. Known values are: \"Valid\", \"Invalid\", and \"Ambiguous\".""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state. Known values are: \"Creating\", \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + @overload + def __init__( + self, + *, + address_classification: Optional[Union[str, "_models.AddressClassification"]] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + contact_details: Optional["_models.ContactDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AddressResource(TrackedResource): + """Address Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of an address. Required. + :vartype properties: ~azure.mgmt.edgeorder.models.AddressProperties + """ + + properties: "_models.AddressProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of an address. Required.""" + + __flattened_items = [ + "address_classification", + "shipping_address", + "contact_details", + "address_validation_status", + "provisioning_state", + ] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.AddressProperties", + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AddressUpdateParameter(_Model): + """The Address update parameters. + + :ivar properties: Properties of an address to be updated. + :vartype properties: ~azure.mgmt.edgeorder.models.AddressUpdateProperties + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.AddressUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of an address to be updated.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of key value pairs that describe the resource. These tags can be used in viewing and + grouping this resource (across resource groups).""" + + __flattened_items = ["shipping_address", "contact_details"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.AddressUpdateProperties"] = None, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AddressUpdateProperties(_Model): + """Address Update Properties. + + :ivar shipping_address: Shipping details for the address. + :vartype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress + :ivar contact_details: Contact details for the address. + :vartype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails + """ + + shipping_address: Optional["_models.ShippingAddress"] = rest_field( + name="shippingAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Shipping details for the address.""" + contact_details: Optional["_models.ContactDetails"] = rest_field( + name="contactDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contact details for the address.""" + + @overload + def __init__( + self, + *, + shipping_address: Optional["_models.ShippingAddress"] = None, + contact_details: Optional["_models.ContactDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvailabilityInformation(_Model): + """Availability information of a product system. + + :ivar availability_stage: Current availability stage of the product. Known values are: + "Available", "Preview", "Signup", "Discoverable", "ComingSoon", "Unavailable", and + "Deprecated". + :vartype availability_stage: str or ~azure.mgmt.edgeorder.models.AvailabilityStage + :ivar disabled_reason: Reason why the product is disabled. Known values are: "None", "Country", + "Region", "Feature", "OfferType", "NoSubscriptionInfo", "NotAvailable", and "OutOfStock". + :vartype disabled_reason: str or ~azure.mgmt.edgeorder.models.DisabledReason + :ivar disabled_reason_message: Message for why the product is disabled. + :vartype disabled_reason_message: str + """ + + availability_stage: Optional[Union[str, "_models.AvailabilityStage"]] = rest_field( + name="availabilityStage", visibility=["read"] + ) + """Current availability stage of the product. Known values are: \"Available\", \"Preview\", + \"Signup\", \"Discoverable\", \"ComingSoon\", \"Unavailable\", and \"Deprecated\".""" + disabled_reason: Optional[Union[str, "_models.DisabledReason"]] = rest_field( + name="disabledReason", visibility=["read"] + ) + """Reason why the product is disabled. Known values are: \"None\", \"Country\", \"Region\", + \"Feature\", \"OfferType\", \"NoSubscriptionInfo\", \"NotAvailable\", and \"OutOfStock\".""" + disabled_reason_message: Optional[str] = rest_field(name="disabledReasonMessage", visibility=["read"]) + """Message for why the product is disabled.""" + + +class BasicInformation(_Model): + """Basic information for any product system. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + """ + + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Display Name for the product system.""" + description: Optional["_models.Description"] = rest_field(visibility=["read"]) + """Description related to the product system.""" + image_information: Optional[List["_models.ImageInformation"]] = rest_field( + name="imageInformation", visibility=["read"] + ) + """Image information for the product system.""" + cost_information: Optional["_models.CostInformation"] = rest_field(name="costInformation", visibility=["read"]) + """Cost information for the product system.""" + availability_information: Optional["_models.AvailabilityInformation"] = rest_field( + name="availabilityInformation", visibility=["read"] + ) + """Availability information of the product system.""" + hierarchy_information: Optional["_models.HierarchyInformation"] = rest_field( + name="hierarchyInformation", visibility=["read"] + ) + """Hierarchy information of a product.""" + fulfilled_by: Optional[Union[str, "_models.FulfillmentType"]] = rest_field(name="fulfilledBy", visibility=["read"]) + """The entity responsible for fulfillment of the item at the given hierarchy level. Known values + are: \"Microsoft\" and \"External\".""" + + +class BillingMeterDetails(_Model): + """Holds billing meter details for each type of billing. + + :ivar name: Represents Billing type name. + :vartype name: str + :ivar meter_details: Represents MeterDetails. + :vartype meter_details: ~azure.mgmt.edgeorder.models.MeterDetails + :ivar metering_type: Represents Metering type (eg one-time or recurrent). Known values are: + "OneTime", "Recurring", and "Adhoc". + :vartype metering_type: str or ~azure.mgmt.edgeorder.models.MeteringType + :ivar frequency: Frequency of recurrence. + :vartype frequency: str + :ivar term_type_details: Represent Term Type details. + :vartype term_type_details: ~azure.mgmt.edgeorder.models.TermTypeDetails + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Represents Billing type name.""" + meter_details: Optional["_models.MeterDetails"] = rest_field(name="meterDetails", visibility=["read"]) + """Represents MeterDetails.""" + metering_type: Optional[Union[str, "_models.MeteringType"]] = rest_field(name="meteringType", visibility=["read"]) + """Represents Metering type (eg one-time or recurrent). Known values are: \"OneTime\", + \"Recurring\", and \"Adhoc\".""" + frequency: Optional[str] = rest_field(visibility=["read"]) + """Frequency of recurrence.""" + term_type_details: Optional["_models.TermTypeDetails"] = rest_field(name="termTypeDetails", visibility=["read"]) + """Represent Term Type details.""" + + +class CancellationReason(_Model): + """Reason for cancellation. + + :ivar reason: Reason for cancellation. Required. + :vartype reason: str + """ + + reason: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reason for cancellation. Required.""" + + @overload + def __init__( + self, + *, + reason: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CategoryInformation(_Model): + """Category related properties of a child configuration. + + :ivar category_name: Category name of the child configuration. + :vartype category_name: str + :ivar category_display_name: Category display name of the child configuration. + :vartype category_display_name: str + :ivar description: Description text for the category. + :vartype description: str + :ivar links: Links for the category. + :vartype links: list[~azure.mgmt.edgeorder.models.Link] + """ + + category_name: Optional[str] = rest_field( + name="categoryName", visibility=["read", "create", "update", "delete", "query"] + ) + """Category name of the child configuration.""" + category_display_name: Optional[str] = rest_field( + name="categoryDisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Category display name of the child configuration.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description text for the category.""" + links: Optional[List["_models.Link"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Links for the category.""" + + @overload + def __init__( + self, + *, + category_name: Optional[str] = None, + category_display_name: Optional[str] = None, + description: Optional[str] = None, + links: Optional[List["_models.Link"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ChildConfiguration(_Model): + """Child configuration object. + + :ivar properties: Properties of child configuration. + :vartype properties: ~azure.mgmt.edgeorder.models.ChildConfigurationProperties + """ + + properties: Optional["_models.ChildConfigurationProperties"] = rest_field(visibility=["read"]) + """Properties of child configuration.""" + + __flattened_items = [ + "child_configuration_type", + "is_part_of_base_configuration", + "minimum_quantity", + "maximum_quantity", + "specifications", + "dimensions", + "provisioning_support", + "child_configuration_types", + "grouped_child_configurations", + "supported_term_commitment_durations", + "filterable_properties", + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + ] + + +class ChildConfigurationFilter(_Model): + """Child configuration filter. + + :ivar hierarchy_informations: The list of child configuration hierarchy customer wants to + filter for the given configuration. + :vartype hierarchy_informations: list[~azure.mgmt.edgeorder.models.HierarchyInformation] + :ivar child_configuration_types: Filter to fetch all child configurations belonging to the + given list of configuration types. + :vartype child_configuration_types: list[str or + ~azure.mgmt.edgeorder.models.ChildConfigurationType] + """ + + hierarchy_informations: Optional[List["_models.HierarchyInformation"]] = rest_field( + name="hierarchyInformations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of child configuration hierarchy customer wants to filter for the given configuration.""" + child_configuration_types: Optional[List[Union[str, "_models.ChildConfigurationType"]]] = rest_field( + name="childConfigurationTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Filter to fetch all child configurations belonging to the given list of configuration types.""" + + @overload + def __init__( + self, + *, + hierarchy_informations: Optional[List["_models.HierarchyInformation"]] = None, + child_configuration_types: Optional[List[Union[str, "_models.ChildConfigurationType"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ChildConfigurationProperties(_Model): + """Properties of child configuration. + + :ivar child_configuration_type: Child configuration type. Known values are: + "DeviceConfiguration" and "AdditionalConfiguration". + :vartype child_configuration_type: str or ~azure.mgmt.edgeorder.models.ChildConfigurationType + :ivar is_part_of_base_configuration: 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. + :vartype is_part_of_base_configuration: bool + :ivar minimum_quantity: Minimum quantity a customer can order while choosing this + configuration. + :vartype minimum_quantity: int + :ivar maximum_quantity: Maximum quantity a customer can order while choosing this + configuration. + :vartype maximum_quantity: int + :ivar specifications: Specifications of the configuration. + :vartype specifications: list[~azure.mgmt.edgeorder.models.Specification] + :ivar dimensions: Dimensions of the configuration. + :vartype dimensions: ~azure.mgmt.edgeorder.models.Dimensions + :ivar provisioning_support: Determining nature of provisioning that the configuration supports. + Known values are: "CloudBased" and "Manual". + :vartype provisioning_support: str or ~azure.mgmt.edgeorder.models.ProvisioningSupport + :ivar child_configuration_types: Different types of child configurations which exist for this + configuration, these can be used to populate the child configuration filter. + :vartype child_configuration_types: list[str or + ~azure.mgmt.edgeorder.models.ChildConfigurationType] + :ivar grouped_child_configurations: Child configurations present for the configuration after + applying child configuration filter, grouped by the category name of the child configuration. + :vartype grouped_child_configurations: + list[~azure.mgmt.edgeorder.models.GroupedChildConfigurations] + :ivar supported_term_commitment_durations: The Term Commitment Durations that are supported for + a configuration. + :vartype supported_term_commitment_durations: list[~datetime.timedelta] + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + """ + + child_configuration_type: Optional[Union[str, "_models.ChildConfigurationType"]] = rest_field( + name="childConfigurationType", visibility=["read"] + ) + """Child configuration type. Known values are: \"DeviceConfiguration\" and + \"AdditionalConfiguration\".""" + is_part_of_base_configuration: Optional[bool] = rest_field(name="isPartOfBaseConfiguration", visibility=["read"]) + """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: Optional[int] = rest_field(name="minimumQuantity", visibility=["read"]) + """Minimum quantity a customer can order while choosing this configuration.""" + maximum_quantity: Optional[int] = rest_field(name="maximumQuantity", visibility=["read"]) + """Maximum quantity a customer can order while choosing this configuration.""" + specifications: Optional[List["_models.Specification"]] = rest_field(visibility=["read"]) + """Specifications of the configuration.""" + dimensions: Optional["_models.Dimensions"] = rest_field(visibility=["read"]) + """Dimensions of the configuration.""" + provisioning_support: Optional[Union[str, "_models.ProvisioningSupport"]] = rest_field( + name="provisioningSupport", visibility=["read"] + ) + """Determining nature of provisioning that the configuration supports. Known values are: + \"CloudBased\" and \"Manual\".""" + child_configuration_types: Optional[List[Union[str, "_models.ChildConfigurationType"]]] = rest_field( + name="childConfigurationTypes", visibility=["read"] + ) + """Different types of child configurations which exist for this configuration, these can be used + to populate the child configuration filter.""" + grouped_child_configurations: Optional[List["_models.GroupedChildConfigurations"]] = rest_field( + name="groupedChildConfigurations", visibility=["read"] + ) + """Child configurations present for the configuration after applying child configuration filter, + grouped by the category name of the child configuration.""" + supported_term_commitment_durations: Optional[List[datetime.timedelta]] = rest_field( + name="supportedTermCommitmentDurations", visibility=["read"] + ) + """The Term Commitment Durations that are supported for a configuration.""" + filterable_properties: Optional[List["_models.FilterableProperty"]] = rest_field( + name="filterableProperties", visibility=["read"] + ) + """List of filters supported for a product.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Display Name for the product system.""" + description: Optional["_models.Description"] = rest_field(visibility=["read"]) + """Description related to the product system.""" + image_information: Optional[List["_models.ImageInformation"]] = rest_field( + name="imageInformation", visibility=["read"] + ) + """Image information for the product system.""" + cost_information: Optional["_models.CostInformation"] = rest_field(name="costInformation", visibility=["read"]) + """Cost information for the product system.""" + availability_information: Optional["_models.AvailabilityInformation"] = rest_field( + name="availabilityInformation", visibility=["read"] + ) + """Availability information of the product system.""" + hierarchy_information: Optional["_models.HierarchyInformation"] = rest_field( + name="hierarchyInformation", visibility=["read"] + ) + """Hierarchy information of a product.""" + fulfilled_by: Optional[Union[str, "_models.FulfillmentType"]] = rest_field(name="fulfilledBy", visibility=["read"]) + """The entity responsible for fulfillment of the item at the given hierarchy level. Known values + are: \"Microsoft\" and \"External\".""" + + +class CommonProperties(BasicInformation): + """Represents common properties across product hierarchy. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + """ + + filterable_properties: Optional[List["_models.FilterableProperty"]] = rest_field( + name="filterableProperties", visibility=["read"] + ) + """List of filters supported for a product.""" + + +class Configuration(_Model): + """Configuration object. + + :ivar properties: Properties of configuration. + :vartype properties: ~azure.mgmt.edgeorder.models.ConfigurationProperties + """ + + properties: Optional["_models.ConfigurationProperties"] = rest_field(visibility=["read"]) + """Properties of configuration.""" + + __flattened_items = [ + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + "filterable_properties", + "specifications", + "dimensions", + "provisioning_support", + "child_configuration_types", + "grouped_child_configurations", + "supported_term_commitment_durations", + ] + + +class ConfigurationDeviceDetails(_Model): + """Device details for configuration. + + :ivar display_info: Display details of the product. + :vartype display_info: ~azure.mgmt.edgeorder.models.DisplayInfo + :ivar hierarchy_information: Hierarchy of the product which uniquely identifies the + configuration. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar quantity: Quantity of the product. + :vartype quantity: int + :ivar identification_type: Identification type of the configuration. Known values are: + "NotSupported" and "SerialNumber". + :vartype identification_type: str or ~azure.mgmt.edgeorder.models.IdentificationType + :ivar device_details: List of device details. + :vartype device_details: list[~azure.mgmt.edgeorder.models.DeviceDetails] + :ivar term_commitment_information: Term Commitment Information of the Device. + :vartype term_commitment_information: ~azure.mgmt.edgeorder.models.TermCommitmentInformation + """ + + display_info: Optional["_models.DisplayInfo"] = rest_field( + name="displayInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Display details of the product.""" + hierarchy_information: Optional["_models.HierarchyInformation"] = rest_field( + name="hierarchyInformation", visibility=["read"] + ) + """Hierarchy of the product which uniquely identifies the configuration.""" + quantity: Optional[int] = rest_field(visibility=["read"]) + """Quantity of the product.""" + identification_type: Optional[Union[str, "_models.IdentificationType"]] = rest_field( + name="identificationType", visibility=["read"] + ) + """Identification type of the configuration. Known values are: \"NotSupported\" and + \"SerialNumber\".""" + device_details: Optional[List["_models.DeviceDetails"]] = rest_field(name="deviceDetails", visibility=["read"]) + """List of device details.""" + term_commitment_information: Optional["_models.TermCommitmentInformation"] = rest_field( + name="termCommitmentInformation", visibility=["read"] + ) + """Term Commitment Information of the Device.""" + + @overload + def __init__( + self, + *, + display_info: Optional["_models.DisplayInfo"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConfigurationFilter(_Model): + """Configuration filters. + + :ivar hierarchy_information: Product hierarchy information. Required. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar filterable_property: Filters specific to product. + :vartype filterable_property: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar child_configuration_filter: 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. + :vartype child_configuration_filter: ~azure.mgmt.edgeorder.models.ChildConfigurationFilter + """ + + hierarchy_information: "_models.HierarchyInformation" = rest_field( + name="hierarchyInformation", visibility=["read", "create", "update", "delete", "query"] + ) + """Product hierarchy information. Required.""" + filterable_property: Optional[List["_models.FilterableProperty"]] = rest_field( + name="filterableProperty", visibility=["read", "create", "update", "delete", "query"] + ) + """Filters specific to product.""" + child_configuration_filter: Optional["_models.ChildConfigurationFilter"] = rest_field( + name="childConfigurationFilter", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + hierarchy_information: "_models.HierarchyInformation", + filterable_property: Optional[List["_models.FilterableProperty"]] = None, + child_configuration_filter: Optional["_models.ChildConfigurationFilter"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConfigurationProperties(CommonProperties): + """Properties of configuration. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar specifications: Specifications of the configuration. + :vartype specifications: list[~azure.mgmt.edgeorder.models.Specification] + :ivar dimensions: Dimensions of the configuration. + :vartype dimensions: ~azure.mgmt.edgeorder.models.Dimensions + :ivar provisioning_support: Determining nature of provisioning that the configuration supports. + Known values are: "CloudBased" and "Manual". + :vartype provisioning_support: str or ~azure.mgmt.edgeorder.models.ProvisioningSupport + :ivar child_configuration_types: Different types of child configurations which exist for this + configuration, these can be used to populate the child configuration filter. + :vartype child_configuration_types: list[str or + ~azure.mgmt.edgeorder.models.ChildConfigurationType] + :ivar grouped_child_configurations: Child configurations present for the configuration after + applying child configuration filter, grouped by the category name of the child configuration. + :vartype grouped_child_configurations: + list[~azure.mgmt.edgeorder.models.GroupedChildConfigurations] + :ivar supported_term_commitment_durations: The Term Commitment Durations that are supported for + a configuration. + :vartype supported_term_commitment_durations: list[~datetime.timedelta] + """ + + specifications: Optional[List["_models.Specification"]] = rest_field(visibility=["read"]) + """Specifications of the configuration.""" + dimensions: Optional["_models.Dimensions"] = rest_field(visibility=["read"]) + """Dimensions of the configuration.""" + provisioning_support: Optional[Union[str, "_models.ProvisioningSupport"]] = rest_field( + name="provisioningSupport", visibility=["read"] + ) + """Determining nature of provisioning that the configuration supports. Known values are: + \"CloudBased\" and \"Manual\".""" + child_configuration_types: Optional[List[Union[str, "_models.ChildConfigurationType"]]] = rest_field( + name="childConfigurationTypes", visibility=["read"] + ) + """Different types of child configurations which exist for this configuration, these can be used + to populate the child configuration filter.""" + grouped_child_configurations: Optional[List["_models.GroupedChildConfigurations"]] = rest_field( + name="groupedChildConfigurations", visibility=["read"] + ) + """Child configurations present for the configuration after applying child configuration filter, + grouped by the category name of the child configuration.""" + supported_term_commitment_durations: Optional[List[datetime.timedelta]] = rest_field( + name="supportedTermCommitmentDurations", visibility=["read"] + ) + """The Term Commitment Durations that are supported for a configuration.""" + + +class ConfigurationsRequest(_Model): + """Configuration request object. + + :ivar configuration_filter: Holds details about product hierarchy information and filterable + property. + :vartype configuration_filter: ~azure.mgmt.edgeorder.models.ConfigurationFilter + :ivar customer_subscription_details: Customer subscription properties. Clients can display + available products to unregistered customers by explicitly passing subscription details. + :vartype customer_subscription_details: + ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails + """ + + configuration_filter: Optional["_models.ConfigurationFilter"] = rest_field( + name="configurationFilter", visibility=["read", "create", "update", "delete", "query"] + ) + """Holds details about product hierarchy information and filterable property.""" + customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = rest_field( + name="customerSubscriptionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer subscription properties. Clients can display available products to unregistered + customers by explicitly passing subscription details.""" + + @overload + def __init__( + self, + *, + configuration_filter: Optional["_models.ConfigurationFilter"] = None, + customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContactDetails(_Model): + """Contact Details. + + :ivar contact_name: Contact name of the person. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + :ivar email_list: List of Email-ids to be notified about job progress. + :vartype email_list: list[str] + """ + + contact_name: Optional[str] = rest_field( + name="contactName", visibility=["read", "create", "update", "delete", "query"] + ) + """Contact name of the person.""" + phone: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Phone number of the contact person.""" + phone_extension: Optional[str] = rest_field( + name="phoneExtension", visibility=["read", "create", "update", "delete", "query"] + ) + """Phone extension number of the contact person.""" + mobile: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Mobile number of the contact person.""" + email_list: Optional[List[str]] = rest_field( + name="emailList", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Email-ids to be notified about job progress.""" + + @overload + def __init__( + self, + *, + contact_name: Optional[str] = None, + phone: Optional[str] = None, + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + email_list: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CostInformation(_Model): + """Cost information for the product system. + + :ivar billing_meter_details: Details on the various billing aspects for the product system. + :vartype billing_meter_details: list[~azure.mgmt.edgeorder.models.BillingMeterDetails] + :ivar billing_info_url: Default url to display billing information. + :vartype billing_info_url: str + """ + + billing_meter_details: Optional[List["_models.BillingMeterDetails"]] = rest_field( + name="billingMeterDetails", visibility=["read"] + ) + """Details on the various billing aspects for the product system.""" + billing_info_url: Optional[str] = rest_field(name="billingInfoUrl", visibility=["read"]) + """Default url to display billing information.""" + + +class CustomerSubscriptionDetails(_Model): + """Holds Customer subscription details. Clients can display available products to unregistered + customers by explicitly passing subscription details. + + :ivar registered_features: List of registered feature flags for subscription. + :vartype registered_features: + list[~azure.mgmt.edgeorder.models.CustomerSubscriptionRegisteredFeatures] + :ivar location_placement_id: Location placement Id of a subscription. + :vartype location_placement_id: str + :ivar quota_id: Quota ID of a subscription. Required. + :vartype quota_id: str + """ + + registered_features: Optional[List["_models.CustomerSubscriptionRegisteredFeatures"]] = rest_field( + name="registeredFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """List of registered feature flags for subscription.""" + location_placement_id: Optional[str] = rest_field( + name="locationPlacementId", visibility=["read", "create", "update", "delete", "query"] + ) + """Location placement Id of a subscription.""" + quota_id: str = rest_field(name="quotaId", visibility=["read", "create", "update", "delete", "query"]) + """Quota ID of a subscription. Required.""" + + @overload + def __init__( + self, + *, + quota_id: str, + registered_features: Optional[List["_models.CustomerSubscriptionRegisteredFeatures"]] = None, + location_placement_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CustomerSubscriptionRegisteredFeatures(_Model): + """Represents subscription registered features. + + :ivar name: Name of subscription registered feature. + :vartype name: str + :ivar state: State of subscription registered feature. + :vartype state: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of subscription registered feature.""" + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """State of subscription registered feature.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + state: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Description(_Model): + """Description related properties of a product system. + + :ivar description_type: Type of description. "Base" + :vartype description_type: str or ~azure.mgmt.edgeorder.models.DescriptionType + :ivar short_description: Short description of the product system. + :vartype short_description: str + :ivar long_description: Long description of the product system. + :vartype long_description: str + :ivar keywords: Keywords for the product system. + :vartype keywords: list[str] + :ivar attributes: Attributes for the product system. + :vartype attributes: list[str] + :ivar links: Links for the product system. + :vartype links: list[~azure.mgmt.edgeorder.models.Link] + """ + + description_type: Optional[Union[str, "_models.DescriptionType"]] = rest_field( + name="descriptionType", visibility=["read"] + ) + """Type of description. \"Base\"""" + short_description: Optional[str] = rest_field(name="shortDescription", visibility=["read"]) + """Short description of the product system.""" + long_description: Optional[str] = rest_field(name="longDescription", visibility=["read"]) + """Long description of the product system.""" + keywords: Optional[List[str]] = rest_field(visibility=["read"]) + """Keywords for the product system.""" + attributes: Optional[List[str]] = rest_field(visibility=["read"]) + """Attributes for the product system.""" + links: Optional[List["_models.Link"]] = rest_field(visibility=["read"]) + """Links for the product system.""" + + +class DeviceDetails(_Model): + """Device details. + + :ivar serial_number: Device serial number. + :vartype serial_number: str + :ivar display_serial_number: Device serial number to be displayed. + :vartype display_serial_number: str + :ivar management_resource_id: Management Resource Id. + :vartype management_resource_id: str + :ivar management_resource_tenant_id: Management Resource Tenant ID. + :vartype management_resource_tenant_id: str + :ivar provisioning_support: Determining nature of provisioning that the configuration supports. + Known values are: "CloudBased" and "Manual". + :vartype provisioning_support: str or ~azure.mgmt.edgeorder.models.ProvisioningSupport + :ivar provisioning_details: Provisioning Details for the device. + :vartype provisioning_details: ~azure.mgmt.edgeorder.models.ProvisioningDetails + """ + + serial_number: Optional[str] = rest_field(name="serialNumber", visibility=["read"]) + """Device serial number.""" + display_serial_number: Optional[str] = rest_field(name="displaySerialNumber", visibility=["read"]) + """Device serial number to be displayed.""" + management_resource_id: Optional[str] = rest_field(name="managementResourceId", visibility=["read"]) + """Management Resource Id.""" + management_resource_tenant_id: Optional[str] = rest_field(name="managementResourceTenantId", visibility=["read"]) + """Management Resource Tenant ID.""" + provisioning_support: Optional[Union[str, "_models.ProvisioningSupport"]] = rest_field( + name="provisioningSupport", visibility=["read"] + ) + """Determining nature of provisioning that the configuration supports. Known values are: + \"CloudBased\" and \"Manual\".""" + provisioning_details: Optional["_models.ProvisioningDetails"] = rest_field( + name="provisioningDetails", visibility=["read"] + ) + """Provisioning Details for the device.""" + + +class DevicePresenceVerificationDetails(_Model): + """Proof of possession details. + + :ivar status: Proof of possession status. Known values are: "NotInitiated" and "Completed". + :vartype status: str or ~azure.mgmt.edgeorder.models.DevicePresenceVerificationStatus + :ivar message: Insights on current status. + :vartype message: str + """ + + status: Optional[Union[str, "_models.DevicePresenceVerificationStatus"]] = rest_field(visibility=["read"]) + """Proof of possession status. Known values are: \"NotInitiated\" and \"Completed\".""" + message: Optional[str] = rest_field(visibility=["read"]) + """Insights on current status.""" + + +class Dimensions(_Model): + """Dimensions of a configuration. + + :ivar length: Length of the device. + :vartype length: float + :ivar height: Height of the device. + :vartype height: float + :ivar width: Width of the device. + :vartype width: float + :ivar length_height_unit: Unit for the dimensions of length, height and width. Known values + are: "IN" and "CM". + :vartype length_height_unit: str or ~azure.mgmt.edgeorder.models.LengthHeightUnit + :ivar weight: Weight of the device. + :vartype weight: float + :ivar depth: Depth of the device. + :vartype depth: float + :ivar weight_unit: Unit for the dimensions of weight. Known values are: "LBS" and "KGS". + :vartype weight_unit: str or ~azure.mgmt.edgeorder.models.WeightMeasurementUnit + """ + + length: Optional[float] = rest_field(visibility=["read"]) + """Length of the device.""" + height: Optional[float] = rest_field(visibility=["read"]) + """Height of the device.""" + width: Optional[float] = rest_field(visibility=["read"]) + """Width of the device.""" + length_height_unit: Optional[Union[str, "_models.LengthHeightUnit"]] = rest_field( + name="lengthHeightUnit", visibility=["read"] + ) + """Unit for the dimensions of length, height and width. Known values are: \"IN\" and \"CM\".""" + weight: Optional[float] = rest_field(visibility=["read"]) + """Weight of the device.""" + depth: Optional[float] = rest_field(visibility=["read"]) + """Depth of the device.""" + weight_unit: Optional[Union[str, "_models.WeightMeasurementUnit"]] = rest_field( + name="weightUnit", visibility=["read"] + ) + """Unit for the dimensions of weight. Known values are: \"LBS\" and \"KGS\".""" + + +class DisplayInfo(_Model): + """Describes product display information. + + :ivar product_family_display_name: Product family display name. + :vartype product_family_display_name: str + :ivar configuration_display_name: Configuration display name. + :vartype configuration_display_name: str + """ + + product_family_display_name: Optional[str] = rest_field(name="productFamilyDisplayName", visibility=["read"]) + """Product family display name.""" + configuration_display_name: Optional[str] = rest_field(name="configurationDisplayName", visibility=["read"]) + """Configuration display name.""" + + +class EncryptionPreferences(_Model): + """Preferences related to the double encryption. + + :ivar double_encryption_status: Double encryption status as entered by the customer. It is + compulsory to give this parameter if the 'Deny' or 'Disabled' policy is configured. Known + values are: "Disabled" and "Enabled". + :vartype double_encryption_status: str or ~azure.mgmt.edgeorder.models.DoubleEncryptionStatus + """ + + double_encryption_status: Optional[Union[str, "_models.DoubleEncryptionStatus"]] = rest_field( + name="doubleEncryptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Double encryption status as entered by the customer. It is compulsory to give this parameter if + the 'Deny' or 'Disabled' policy is configured. Known values are: \"Disabled\" and \"Enabled\".""" + + @overload + def __init__( + self, + *, + double_encryption_status: Optional[Union[str, "_models.DoubleEncryptionStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.edgeorder.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.edgeorder.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.edgeorder.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FilterableProperty(_Model): + """Different types of filters supported and its values. + + :ivar type: Type of product filter. Required. Known values are: "ShipToCountries" and + "DoubleEncryptionStatus". + :vartype type: str or ~azure.mgmt.edgeorder.models.SupportedFilterTypes + :ivar supported_values: Values to be filtered. Required. + :vartype supported_values: list[str] + """ + + type: Union[str, "_models.SupportedFilterTypes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Type of product filter. Required. Known values are: \"ShipToCountries\" and + \"DoubleEncryptionStatus\".""" + supported_values: List[str] = rest_field( + name="supportedValues", visibility=["read", "create", "update", "delete", "query"] + ) + """Values to be filtered. Required.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.SupportedFilterTypes"], + supported_values: List[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ForwardShippingDetails(_Model): + """Forward shipment details. + + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar carrier_display_name: Carrier Name for display purpose. Not to be used for any + processing. + :vartype carrier_display_name: str + :ivar tracking_id: TrackingId of the package. + :vartype tracking_id: str + :ivar tracking_url: TrackingUrl of the package. + :vartype tracking_url: str + """ + + carrier_name: Optional[str] = rest_field(name="carrierName", visibility=["read"]) + """Name of the carrier.""" + carrier_display_name: Optional[str] = rest_field(name="carrierDisplayName", visibility=["read"]) + """Carrier Name for display purpose. Not to be used for any processing.""" + tracking_id: Optional[str] = rest_field(name="trackingId", visibility=["read"]) + """TrackingId of the package.""" + tracking_url: Optional[str] = rest_field(name="trackingUrl", visibility=["read"]) + """TrackingUrl of the package.""" + + +class GroupedChildConfigurations(_Model): + """Grouped child configuration object. + + :ivar category_information: Category information. + :vartype category_information: ~azure.mgmt.edgeorder.models.CategoryInformation + :ivar child_configurations: List of child configurations. + :vartype child_configurations: list[~azure.mgmt.edgeorder.models.ChildConfiguration] + """ + + category_information: Optional["_models.CategoryInformation"] = rest_field( + name="categoryInformation", visibility=["read"] + ) + """Category information.""" + child_configurations: Optional[List["_models.ChildConfiguration"]] = rest_field( + name="childConfigurations", visibility=["read"] + ) + """List of child configurations.""" + + +class HierarchyInformation(_Model): + """Holds details about product hierarchy information. + + :ivar product_family_name: Represents product family name that uniquely identifies product + family. + :vartype product_family_name: str + :ivar product_line_name: Represents product line name that uniquely identifies product line. + :vartype product_line_name: str + :ivar product_name: Represents product name that uniquely identifies product. + :vartype product_name: str + :ivar configuration_name: Represents configuration name that uniquely identifies configuration. + :vartype configuration_name: str + :ivar configuration_id_display_name: Represents Model Display Name. + :vartype configuration_id_display_name: str + """ + + product_family_name: Optional[str] = rest_field( + name="productFamilyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents product family name that uniquely identifies product family.""" + product_line_name: Optional[str] = rest_field( + name="productLineName", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents product line name that uniquely identifies product line.""" + product_name: Optional[str] = rest_field( + name="productName", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents product name that uniquely identifies product.""" + configuration_name: Optional[str] = rest_field( + name="configurationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents configuration name that uniquely identifies configuration.""" + configuration_id_display_name: Optional[str] = rest_field( + name="configurationIdDisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents Model Display Name.""" + + @overload + def __init__( + self, + *, + product_family_name: Optional[str] = None, + product_line_name: Optional[str] = None, + product_name: Optional[str] = None, + configuration_name: Optional[str] = None, + configuration_id_display_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageInformation(_Model): + """Image for the product. + + :ivar image_type: Type of the image. Known values are: "MainImage", "BulletImage", and + "GenericImage". + :vartype image_type: str or ~azure.mgmt.edgeorder.models.ImageType + :ivar image_url: Url of the image. + :vartype image_url: str + """ + + image_type: Optional[Union[str, "_models.ImageType"]] = rest_field(name="imageType", visibility=["read"]) + """Type of the image. Known values are: \"MainImage\", \"BulletImage\", and \"GenericImage\".""" + image_url: Optional[str] = rest_field(name="imageUrl", visibility=["read"]) + """Url of the image.""" + + +class Link(_Model): + """Returns link related to the product. + + :ivar link_type: Type of link. Known values are: "Generic", "TermsAndConditions", + "Specification", "Documentation", "KnowMore", "SignUp", and "Discoverable". + :vartype link_type: str or ~azure.mgmt.edgeorder.models.LinkType + :ivar link_url: Url of the link. + :vartype link_url: str + """ + + link_type: Optional[Union[str, "_models.LinkType"]] = rest_field(name="linkType", visibility=["read"]) + """Type of link. Known values are: \"Generic\", \"TermsAndConditions\", \"Specification\", + \"Documentation\", \"KnowMore\", \"SignUp\", and \"Discoverable\".""" + link_url: Optional[str] = rest_field(name="linkUrl", visibility=["read"]) + """Url of the link.""" + + +class ManagementResourcePreferences(_Model): + """Management resource preference to link device. + + :ivar preferred_management_resource_id: Customer preferred Management resource ARM ID. + :vartype preferred_management_resource_id: str + """ + + preferred_management_resource_id: Optional[str] = rest_field( + name="preferredManagementResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer preferred Management resource ARM ID.""" + + @overload + def __init__( + self, + *, + preferred_management_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MeterDetails(_Model): + """Holds details about billing type and its meter guids. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + Pav2MeterDetails, PurchaseMeterDetails + + :ivar billing_type: Represents billing type. Required. Known values are: "Pav2" and "Purchase". + :vartype billing_type: str or ~azure.mgmt.edgeorder.models.BillingType + :ivar multiplier: Billing unit applicable for Pav2 billing. + :vartype multiplier: float + :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". + :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType + """ + + __mapping__: Dict[str, _Model] = {} + billing_type: str = rest_discriminator( + name="billingType", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents billing type. Required. Known values are: \"Pav2\" and \"Purchase\".""" + multiplier: Optional[float] = rest_field(visibility=["read"]) + """Billing unit applicable for Pav2 billing.""" + charging_type: Optional[Union[str, "_models.ChargingType"]] = rest_field(name="chargingType", visibility=["read"]) + """Charging type. Known values are: \"PerOrder\" and \"PerDevice\".""" + + @overload + def __init__( + self, + *, + billing_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NotificationPreference(_Model): + """Notification preference for a job stage. + + :ivar stage_name: Name of the stage. Required. Known values are: "Shipped" and "Delivered". + :vartype stage_name: str or ~azure.mgmt.edgeorder.models.NotificationStageName + :ivar send_notification: Notification is required or not. Required. + :vartype send_notification: bool + """ + + stage_name: Union[str, "_models.NotificationStageName"] = rest_field( + name="stageName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the stage. Required. Known values are: \"Shipped\" and \"Delivered\".""" + send_notification: bool = rest_field( + name="sendNotification", visibility=["read", "create", "update", "delete", "query"] + ) + """Notification is required or not. Required.""" + + @overload + def __init__( + self, + *, + stage_name: Union[str, "_models.NotificationStageName"], + send_notification: bool, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OkResponse(_Model): + """The request has succeeded.""" + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.edgeorder.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.edgeorder.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.edgeorder.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for and operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OrderItemDetails(_Model): + """Order item details. + + :ivar product_details: Represents product details. Required. + :vartype product_details: ~azure.mgmt.edgeorder.models.ProductDetails + :ivar order_item_type: Order item type. Required. Known values are: "Purchase", "Rental", and + "External". + :vartype order_item_type: str or ~azure.mgmt.edgeorder.models.OrderItemType + :ivar order_item_mode: Defines the mode of the Order item. Known values are: "Default" and + "DoNotFulfill". + :vartype order_item_mode: str or ~azure.mgmt.edgeorder.models.OrderMode + :ivar site_details: Site Related Details. + :vartype site_details: ~azure.mgmt.edgeorder.models.SiteDetails + :ivar current_stage: Current Order item Status. + :vartype current_stage: ~azure.mgmt.edgeorder.models.StageDetails + :ivar order_item_stage_history: Order item status history. + :vartype order_item_stage_history: list[~azure.mgmt.edgeorder.models.StageDetails] + :ivar preferences: Customer notification Preferences. + :vartype preferences: ~azure.mgmt.edgeorder.models.Preferences + :ivar forward_shipping_details: Forward Package Shipping details. + :vartype forward_shipping_details: ~azure.mgmt.edgeorder.models.ForwardShippingDetails + :ivar reverse_shipping_details: Reverse Package Shipping details. + :vartype reverse_shipping_details: ~azure.mgmt.edgeorder.models.ReverseShippingDetails + :ivar notification_email_list: Additional notification email list. + :vartype notification_email_list: list[str] + :ivar cancellation_reason: Cancellation reason. + :vartype cancellation_reason: str + :ivar cancellation_status: Describes whether the order item is cancellable or not. Known values + are: "Cancellable", "CancellableWithFee", and "NotCancellable". + :vartype cancellation_status: str or ~azure.mgmt.edgeorder.models.OrderItemCancellationEnum + :ivar deletion_status: Describes whether the order item is deletable or not. Known values are: + "Allowed" and "NotAllowed". + :vartype deletion_status: str or ~azure.mgmt.edgeorder.models.ActionStatusEnum + :ivar return_reason: Return reason. + :vartype return_reason: str + :ivar return_status: Describes whether the order item is returnable or not. Known values are: + "Returnable", "ReturnableWithFee", and "NotReturnable". + :vartype return_status: str or ~azure.mgmt.edgeorder.models.OrderItemReturnEnum + :ivar management_rp_details_list: List of parent RP details supported for configuration. + :vartype management_rp_details_list: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] + :ivar error: Top level error for the job. + :vartype error: ~azure.mgmt.edgeorder.models.ErrorDetail + """ + + product_details: "_models.ProductDetails" = rest_field( + name="productDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents product details. Required.""" + order_item_type: Union[str, "_models.OrderItemType"] = rest_field( + name="orderItemType", visibility=["read", "create", "update", "delete", "query"] + ) + """Order item type. Required. Known values are: \"Purchase\", \"Rental\", and \"External\".""" + order_item_mode: Optional[Union[str, "_models.OrderMode"]] = rest_field( + name="orderItemMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines the mode of the Order item. Known values are: \"Default\" and \"DoNotFulfill\".""" + site_details: Optional["_models.SiteDetails"] = rest_field( + name="siteDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Site Related Details.""" + current_stage: Optional["_models.StageDetails"] = rest_field(name="currentStage", visibility=["read"]) + """Current Order item Status.""" + order_item_stage_history: Optional[List["_models.StageDetails"]] = rest_field( + name="orderItemStageHistory", visibility=["read"] + ) + """Order item status history.""" + preferences: Optional["_models.Preferences"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Customer notification Preferences.""" + forward_shipping_details: Optional["_models.ForwardShippingDetails"] = rest_field( + name="forwardShippingDetails", visibility=["read"] + ) + """Forward Package Shipping details.""" + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = rest_field( + name="reverseShippingDetails", visibility=["read"] + ) + """Reverse Package Shipping details.""" + notification_email_list: Optional[List[str]] = rest_field( + name="notificationEmailList", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional notification email list.""" + cancellation_reason: Optional[str] = rest_field(name="cancellationReason", visibility=["read"]) + """Cancellation reason.""" + cancellation_status: Optional[Union[str, "_models.OrderItemCancellationEnum"]] = rest_field( + name="cancellationStatus", visibility=["read"] + ) + """Describes whether the order item is cancellable or not. Known values are: \"Cancellable\", + \"CancellableWithFee\", and \"NotCancellable\".""" + deletion_status: Optional[Union[str, "_models.ActionStatusEnum"]] = rest_field( + name="deletionStatus", visibility=["read"] + ) + """Describes whether the order item is deletable or not. Known values are: \"Allowed\" and + \"NotAllowed\".""" + return_reason: Optional[str] = rest_field(name="returnReason", visibility=["read"]) + """Return reason.""" + return_status: Optional[Union[str, "_models.OrderItemReturnEnum"]] = rest_field( + name="returnStatus", visibility=["read"] + ) + """Describes whether the order item is returnable or not. Known values are: \"Returnable\", + \"ReturnableWithFee\", and \"NotReturnable\".""" + management_rp_details_list: Optional[List["_models.ResourceProviderDetails"]] = rest_field( + name="managementRpDetailsList", visibility=["read"] + ) + """List of parent RP details supported for configuration.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read"]) + """Top level error for the job.""" + + @overload + def __init__( + self, + *, + product_details: "_models.ProductDetails", + order_item_type: Union[str, "_models.OrderItemType"], + order_item_mode: Optional[Union[str, "_models.OrderMode"]] = None, + site_details: Optional["_models.SiteDetails"] = None, + preferences: Optional["_models.Preferences"] = None, + notification_email_list: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OrderItemDetailsUpdateParameter(_Model): + """Order item details Patchable Properties. + + :ivar product_details: Represents product details. + :vartype product_details: ~azure.mgmt.edgeorder.models.ProductDetailsUpdateParameter + :ivar site_details: Site Related Details. + :vartype site_details: ~azure.mgmt.edgeorder.models.SiteDetails + """ + + product_details: Optional["_models.ProductDetailsUpdateParameter"] = rest_field( + name="productDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents product details.""" + site_details: Optional["_models.SiteDetails"] = rest_field( + name="siteDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Site Related Details.""" + + @overload + def __init__( + self, + *, + product_details: Optional["_models.ProductDetailsUpdateParameter"] = None, + site_details: Optional["_models.SiteDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OrderItemProperties(_Model): + """Represents order item properties. + + :ivar order_item_details: Represents order item details. Required. + :vartype order_item_details: ~azure.mgmt.edgeorder.models.OrderItemDetails + :ivar address_details: Represents shipping and return address for order item. + :vartype address_details: ~azure.mgmt.edgeorder.models.AddressDetails + :ivar start_time: Start time of order item. + :vartype start_time: ~datetime.datetime + :ivar order_id: Id of the order to which order item belongs to. Required. + :vartype order_id: str + :ivar provisioning_state: Provisioning state. Known values are: "Creating", "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.edgeorder.models.ProvisioningState + """ + + order_item_details: "_models.OrderItemDetails" = rest_field( + name="orderItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents order item details. Required.""" + address_details: Optional["_models.AddressDetails"] = rest_field( + name="addressDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents shipping and return address for order item.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of order item.""" + order_id: str = rest_field(name="orderId", visibility=["read", "create", "update", "delete", "query"]) + """Id of the order to which order item belongs to. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state. Known values are: \"Creating\", \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + @overload + def __init__( + self, + *, + order_item_details: "_models.OrderItemDetails", + order_id: str, + address_details: Optional["_models.AddressDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OrderItemResource(TrackedResource): + """Represents order item resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Order item properties. Required. + :vartype properties: ~azure.mgmt.edgeorder.models.OrderItemProperties + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.edgeorder.models.ResourceIdentity + """ + + properties: "_models.OrderItemProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Order item properties. Required.""" + identity: Optional["_models.ResourceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Msi identity of the resource.""" + + __flattened_items = ["order_item_details", "address_details", "start_time", "order_id", "provisioning_state"] + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.OrderItemProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class OrderItemUpdateParameter(_Model): + """Updates order item parameters. + + :ivar properties: Order item update properties. + :vartype properties: ~azure.mgmt.edgeorder.models.OrderItemUpdateProperties + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.edgeorder.models.ResourceIdentity + """ + + properties: Optional["_models.OrderItemUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Order item update properties.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of key value pairs that describe the resource. These tags can be used in viewing and + grouping this resource (across resource groups).""" + identity: Optional["_models.ResourceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Msi identity of the resource.""" + + __flattened_items = ["forward_address", "preferences", "notification_email_list", "order_item_details"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.OrderItemUpdateProperties"] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class OrderItemUpdateProperties(_Model): + """Order item update properties. + + :ivar forward_address: Updates forward shipping address and contact details. + :vartype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties + :ivar preferences: Customer preference. + :vartype preferences: ~azure.mgmt.edgeorder.models.Preferences + :ivar notification_email_list: Additional notification email list. + :vartype notification_email_list: list[str] + :ivar order_item_details: Represents order item details. + :vartype order_item_details: ~azure.mgmt.edgeorder.models.OrderItemDetailsUpdateParameter + """ + + forward_address: Optional["_models.AddressProperties"] = rest_field( + name="forwardAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Updates forward shipping address and contact details.""" + preferences: Optional["_models.Preferences"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Customer preference.""" + notification_email_list: Optional[List[str]] = rest_field( + name="notificationEmailList", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional notification email list.""" + order_item_details: Optional["_models.OrderItemDetailsUpdateParameter"] = rest_field( + name="orderItemDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents order item details.""" + + @overload + def __init__( + self, + *, + forward_address: Optional["_models.AddressProperties"] = None, + preferences: Optional["_models.Preferences"] = None, + notification_email_list: Optional[List[str]] = None, + order_item_details: Optional["_models.OrderItemDetailsUpdateParameter"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OrderProperties(_Model): + """Represents order details. + + :ivar order_item_ids: List of order item ARM Ids which are part of an order. + :vartype order_item_ids: list[str] + :ivar current_stage: Order current status. + :vartype current_stage: ~azure.mgmt.edgeorder.models.StageDetails + :ivar order_stage_history: Order status history. + :vartype order_stage_history: list[~azure.mgmt.edgeorder.models.StageDetails] + :ivar order_mode: Order mode. Known values are: "Default" and "DoNotFulfill". + :vartype order_mode: str or ~azure.mgmt.edgeorder.models.OrderMode + """ + + order_item_ids: Optional[List[str]] = rest_field(name="orderItemIds", visibility=["read"]) + """List of order item ARM Ids which are part of an order.""" + current_stage: Optional["_models.StageDetails"] = rest_field(name="currentStage", visibility=["read"]) + """Order current status.""" + order_stage_history: Optional[List["_models.StageDetails"]] = rest_field( + name="orderStageHistory", visibility=["read"] + ) + """Order status history.""" + order_mode: Optional[Union[str, "_models.OrderMode"]] = rest_field(name="orderMode", visibility=["read"]) + """Order mode. Known values are: \"Default\" and \"DoNotFulfill\".""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + """ + + +class OrderResource(ProxyResource): + """Specifies the properties or parameters for an order. Order is a grouping of one or more order + items. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData + :ivar properties: Order properties. Required. + :vartype properties: ~azure.mgmt.edgeorder.models.OrderProperties + """ + + properties: "_models.OrderProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Order properties. Required.""" + + __flattened_items = ["order_item_ids", "current_stage", "order_stage_history", "order_mode"] + + @overload + def __init__( + self, + *, + properties: "_models.OrderProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class Pav2MeterDetails(MeterDetails, discriminator="Pav2"): + """Billing type PAV2 meter details. + + :ivar multiplier: Billing unit applicable for Pav2 billing. + :vartype multiplier: float + :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". + :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType + :ivar meter_guid: Validation status of requested data center and transport. + :vartype meter_guid: str + :ivar billing_type: Represents billing type. Required. PaV2 billing. + :vartype billing_type: str or ~azure.mgmt.edgeorder.models.PAV2 + """ + + meter_guid: Optional[str] = rest_field(name="meterGuid", visibility=["read"]) + """Validation status of requested data center and transport.""" + billing_type: Literal[BillingType.PAV2] = rest_discriminator(name="billingType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Represents billing type. Required. PaV2 billing.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, billing_type=BillingType.PAV2, **kwargs) + + +class Preferences(_Model): + """Preferences related to the order. + + :ivar notification_preferences: Notification preferences. + :vartype notification_preferences: list[~azure.mgmt.edgeorder.models.NotificationPreference] + :ivar transport_preferences: Preferences related to the shipment logistics of the order. + :vartype transport_preferences: ~azure.mgmt.edgeorder.models.TransportPreferences + :ivar encryption_preferences: Preferences related to the Encryption. + :vartype encryption_preferences: ~azure.mgmt.edgeorder.models.EncryptionPreferences + :ivar management_resource_preferences: Preferences related to the Management resource. + :vartype management_resource_preferences: + ~azure.mgmt.edgeorder.models.ManagementResourcePreferences + :ivar term_commitment_preferences: Preferences related to the Term commitment. + :vartype term_commitment_preferences: ~azure.mgmt.edgeorder.models.TermCommitmentPreferences + """ + + notification_preferences: Optional[List["_models.NotificationPreference"]] = rest_field( + name="notificationPreferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Notification preferences.""" + transport_preferences: Optional["_models.TransportPreferences"] = rest_field( + name="transportPreferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferences related to the shipment logistics of the order.""" + encryption_preferences: Optional["_models.EncryptionPreferences"] = rest_field( + name="encryptionPreferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferences related to the Encryption.""" + management_resource_preferences: Optional["_models.ManagementResourcePreferences"] = rest_field( + name="managementResourcePreferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferences related to the Management resource.""" + term_commitment_preferences: Optional["_models.TermCommitmentPreferences"] = rest_field( + name="termCommitmentPreferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferences related to the Term commitment.""" + + @overload + def __init__( + self, + *, + notification_preferences: Optional[List["_models.NotificationPreference"]] = None, + transport_preferences: Optional["_models.TransportPreferences"] = None, + encryption_preferences: Optional["_models.EncryptionPreferences"] = None, + management_resource_preferences: Optional["_models.ManagementResourcePreferences"] = None, + term_commitment_preferences: Optional["_models.TermCommitmentPreferences"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Product(_Model): + """Represents a product. + + :ivar properties: Properties of product. + :vartype properties: ~azure.mgmt.edgeorder.models.ProductProperties + """ + + properties: Optional["_models.ProductProperties"] = rest_field(visibility=["read"]) + """Properties of product.""" + + __flattened_items = [ + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + "filterable_properties", + "configurations", + ] + + +class ProductDetails(_Model): + """Represents product details. + + :ivar display_info: Display details of the product. + :vartype display_info: ~azure.mgmt.edgeorder.models.DisplayInfo + :ivar hierarchy_information: Hierarchy of the product which uniquely identifies the product. + Required. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar product_double_encryption_status: Double encryption status of the configuration. + Read-only field. Known values are: "Disabled" and "Enabled". + :vartype product_double_encryption_status: str or + ~azure.mgmt.edgeorder.models.DoubleEncryptionStatus + :ivar identification_type: Identification type of the configuration. Known values are: + "NotSupported" and "SerialNumber". + :vartype identification_type: str or ~azure.mgmt.edgeorder.models.IdentificationType + :ivar parent_device_details: Device details of the parent configuration. + :vartype parent_device_details: ~azure.mgmt.edgeorder.models.DeviceDetails + :ivar parent_provisioning_details: Device Provisioning Details for Parent. + :vartype parent_provisioning_details: ~azure.mgmt.edgeorder.models.ProvisioningDetails + :ivar opt_in_additional_configurations: List of additional configurations customer wants in the + order item apart from the ones included in the base configuration. + :vartype opt_in_additional_configurations: + list[~azure.mgmt.edgeorder.models.AdditionalConfiguration] + :ivar child_configuration_device_details: Details of all child configurations that are part of + the order item. + :vartype child_configuration_device_details: + list[~azure.mgmt.edgeorder.models.ConfigurationDeviceDetails] + :ivar term_commitment_information: Term Commitment Information of the Device. + :vartype term_commitment_information: ~azure.mgmt.edgeorder.models.TermCommitmentInformation + """ + + display_info: Optional["_models.DisplayInfo"] = rest_field( + name="displayInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Display details of the product.""" + hierarchy_information: "_models.HierarchyInformation" = rest_field( + name="hierarchyInformation", visibility=["read", "create", "update", "delete", "query"] + ) + """Hierarchy of the product which uniquely identifies the product. Required.""" + product_double_encryption_status: Optional[Union[str, "_models.DoubleEncryptionStatus"]] = rest_field( + name="productDoubleEncryptionStatus", visibility=["read"] + ) + """Double encryption status of the configuration. Read-only field. Known values are: \"Disabled\" + and \"Enabled\".""" + identification_type: Optional[Union[str, "_models.IdentificationType"]] = rest_field( + name="identificationType", visibility=["read"] + ) + """Identification type of the configuration. Known values are: \"NotSupported\" and + \"SerialNumber\".""" + parent_device_details: Optional["_models.DeviceDetails"] = rest_field( + name="parentDeviceDetails", visibility=["read"] + ) + """Device details of the parent configuration.""" + parent_provisioning_details: Optional["_models.ProvisioningDetails"] = rest_field( + name="parentProvisioningDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Device Provisioning Details for Parent.""" + opt_in_additional_configurations: Optional[List["_models.AdditionalConfiguration"]] = rest_field( + name="optInAdditionalConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """List of additional configurations customer wants in the order item apart from the ones included + in the base configuration.""" + child_configuration_device_details: Optional[List["_models.ConfigurationDeviceDetails"]] = rest_field( + name="childConfigurationDeviceDetails", visibility=["read"] + ) + """Details of all child configurations that are part of the order item.""" + term_commitment_information: Optional["_models.TermCommitmentInformation"] = rest_field( + name="termCommitmentInformation", visibility=["read"] + ) + """Term Commitment Information of the Device.""" + + @overload + def __init__( + self, + *, + hierarchy_information: "_models.HierarchyInformation", + display_info: Optional["_models.DisplayInfo"] = None, + parent_provisioning_details: Optional["_models.ProvisioningDetails"] = None, + opt_in_additional_configurations: Optional[List["_models.AdditionalConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProductDetailsUpdateParameter(_Model): + """Represents product details patchable properties. + + :ivar parent_provisioning_details: Device Provisioning Details for Parent. + :vartype parent_provisioning_details: ~azure.mgmt.edgeorder.models.ProvisioningDetails + """ + + parent_provisioning_details: Optional["_models.ProvisioningDetails"] = rest_field( + name="parentProvisioningDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Device Provisioning Details for Parent.""" + + @overload + def __init__( + self, + *, + parent_provisioning_details: Optional["_models.ProvisioningDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProductFamiliesMetadataDetails(_Model): + """Product families metadata details. + + :ivar properties: Product family properties. + :vartype properties: ~azure.mgmt.edgeorder.models.ProductFamilyProperties + """ + + properties: Optional["_models.ProductFamilyProperties"] = rest_field(visibility=["read"]) + """Product family properties.""" + + __flattened_items = [ + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + "filterable_properties", + "product_lines", + "resource_provider_details", + ] + + +class ProductFamiliesRequest(_Model): + """The filters for showing the product families. + + :ivar filterable_properties: Dictionary of filterable properties on product family. Required. + :vartype filterable_properties: dict[str, + list[~azure.mgmt.edgeorder.models.FilterableProperty]] + :ivar customer_subscription_details: Customer subscription properties. Clients can display + available products to unregistered customers by explicitly passing subscription details. + :vartype customer_subscription_details: + ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails + """ + + filterable_properties: Dict[str, List["_models.FilterableProperty"]] = rest_field( + name="filterableProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Dictionary of filterable properties on product family. Required.""" + customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = rest_field( + name="customerSubscriptionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer subscription properties. Clients can display available products to unregistered + customers by explicitly passing subscription details.""" + + @overload + def __init__( + self, + *, + filterable_properties: Dict[str, List["_models.FilterableProperty"]], + customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProductFamily(_Model): + """Product Family. + + :ivar properties: Properties of product family. + :vartype properties: ~azure.mgmt.edgeorder.models.ProductFamilyProperties + """ + + properties: Optional["_models.ProductFamilyProperties"] = rest_field(visibility=["read"]) + """Properties of product family.""" + + __flattened_items = [ + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + "filterable_properties", + "product_lines", + "resource_provider_details", + ] + + +class ProductFamilyProperties(CommonProperties): + """Properties of product family. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar product_lines: List of product lines supported in the product family. + :vartype product_lines: list[~azure.mgmt.edgeorder.models.ProductLine] + :ivar resource_provider_details: Contains details related to resource provider. + :vartype resource_provider_details: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] + """ + + product_lines: Optional[List["_models.ProductLine"]] = rest_field(name="productLines", visibility=["read"]) + """List of product lines supported in the product family.""" + resource_provider_details: Optional[List["_models.ResourceProviderDetails"]] = rest_field( + name="resourceProviderDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains details related to resource provider.""" + + @overload + def __init__( + self, + *, + resource_provider_details: Optional[List["_models.ResourceProviderDetails"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProductLine(_Model): + """Product line. + + :ivar properties: Properties of product line. + :vartype properties: ~azure.mgmt.edgeorder.models.ProductLineProperties + """ + + properties: Optional["_models.ProductLineProperties"] = rest_field(visibility=["read"]) + """Properties of product line.""" + + __flattened_items = [ + "display_name", + "description", + "image_information", + "cost_information", + "availability_information", + "hierarchy_information", + "fulfilled_by", + "filterable_properties", + "products", + ] + + +class ProductLineProperties(CommonProperties): + """Properties of product line. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar products: List of products in the product line. + :vartype products: list[~azure.mgmt.edgeorder.models.Product] + """ + + products: Optional[List["_models.Product"]] = rest_field(visibility=["read"]) + """List of products in the product line.""" + + +class ProductProperties(CommonProperties): + """Properties of product. + + :ivar display_name: Display Name for the product system. + :vartype display_name: str + :ivar description: Description related to the product system. + :vartype description: ~azure.mgmt.edgeorder.models.Description + :ivar image_information: Image information for the product system. + :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] + :ivar cost_information: Cost information for the product system. + :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation + :ivar availability_information: Availability information of the product system. + :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation + :ivar hierarchy_information: Hierarchy information of a product. + :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation + :ivar fulfilled_by: The entity responsible for fulfillment of the item at the given hierarchy + level. Known values are: "Microsoft" and "External". + :vartype fulfilled_by: str or ~azure.mgmt.edgeorder.models.FulfillmentType + :ivar filterable_properties: List of filters supported for a product. + :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] + :ivar configurations: List of configurations for the product. + :vartype configurations: list[~azure.mgmt.edgeorder.models.Configuration] + """ + + configurations: Optional[List["_models.Configuration"]] = rest_field(visibility=["read"]) + """List of configurations for the product.""" + + +class ProvisioningDetails(_Model): + """Details Related To Provision Resource. + + :ivar quantity: Quantity of the devices. + :vartype quantity: int + :ivar provisioning_arm_id: Provisioning Resource Arm ID. + :vartype provisioning_arm_id: str + :ivar provisioning_end_point: Provisioning End Point. + :vartype provisioning_end_point: str + :ivar serial_number: Serial Number for the Device. + :vartype serial_number: str + :ivar vendor_name: Vendor Name for the Device , (for 1P devices - Microsoft). + :vartype vendor_name: str + :ivar ready_to_connect_arm_id: Arc Enabled Resource Arm id. + :vartype ready_to_connect_arm_id: str + :ivar management_resource_arm_id: Management Resource ArmId. + :vartype management_resource_arm_id: str + :ivar unique_device_identifier: Unique Identity for a Device. + :vartype unique_device_identifier: str + :ivar auto_provisioning_status: Auto Provisioning Details. Known values are: "Enabled" and + "Disabled". + :vartype auto_provisioning_status: str or ~azure.mgmt.edgeorder.models.AutoProvisioningStatus + :ivar device_presence_verification: Proof of possession details. + :vartype device_presence_verification: + ~azure.mgmt.edgeorder.models.DevicePresenceVerificationDetails + """ + + quantity: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Quantity of the devices.""" + provisioning_arm_id: Optional[str] = rest_field( + name="provisioningArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning Resource Arm ID.""" + provisioning_end_point: Optional[str] = rest_field( + name="provisioningEndPoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning End Point.""" + serial_number: Optional[str] = rest_field( + name="serialNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """Serial Number for the Device.""" + vendor_name: Optional[str] = rest_field( + name="vendorName", visibility=["read", "create", "update", "delete", "query"] + ) + """Vendor Name for the Device , (for 1P devices - Microsoft).""" + ready_to_connect_arm_id: Optional[str] = rest_field( + name="readyToConnectArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Arc Enabled Resource Arm id.""" + management_resource_arm_id: Optional[str] = rest_field( + name="managementResourceArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Management Resource ArmId.""" + unique_device_identifier: Optional[str] = rest_field(name="uniqueDeviceIdentifier", visibility=["read"]) + """Unique Identity for a Device.""" + auto_provisioning_status: Optional[Union[str, "_models.AutoProvisioningStatus"]] = rest_field( + name="autoProvisioningStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Auto Provisioning Details. Known values are: \"Enabled\" and \"Disabled\".""" + device_presence_verification: Optional["_models.DevicePresenceVerificationDetails"] = rest_field( + name="devicePresenceVerification", visibility=["read", "create", "update", "delete", "query"] + ) + """Proof of possession details.""" + + @overload + def __init__( + self, + *, + quantity: Optional[int] = None, + provisioning_arm_id: Optional[str] = None, + provisioning_end_point: Optional[str] = None, + serial_number: Optional[str] = None, + vendor_name: Optional[str] = None, + ready_to_connect_arm_id: Optional[str] = None, + management_resource_arm_id: Optional[str] = None, + auto_provisioning_status: Optional[Union[str, "_models.AutoProvisioningStatus"]] = None, + device_presence_verification: Optional["_models.DevicePresenceVerificationDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PurchaseMeterDetails(MeterDetails, discriminator="Purchase"): + """Billing type Purchase meter details. + + :ivar multiplier: Billing unit applicable for Pav2 billing. + :vartype multiplier: float + :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". + :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType + :ivar product_id: Product Id. + :vartype product_id: str + :ivar sku_id: Sku Id. + :vartype sku_id: str + :ivar term_id: Term Id. + :vartype term_id: str + :ivar billing_type: Represents billing type. Required. Purchase billing. + :vartype billing_type: str or ~azure.mgmt.edgeorder.models.PURCHASE + """ + + product_id: Optional[str] = rest_field(name="productId", visibility=["read"]) + """Product Id.""" + sku_id: Optional[str] = rest_field(name="skuId", visibility=["read"]) + """Sku Id.""" + term_id: Optional[str] = rest_field(name="termId", visibility=["read"]) + """Term Id.""" + billing_type: Literal[BillingType.PURCHASE] = rest_discriminator(name="billingType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Represents billing type. Required. Purchase billing.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, billing_type=BillingType.PURCHASE, **kwargs) + + +class ResourceIdentity(_Model): + """Msi identity details of the resource. + + :ivar type: Identity type. + :vartype type: str + :ivar principal_id: Service Principal Id backing the Msi. + :vartype principal_id: str + :ivar tenant_id: Home Tenant Id. + :vartype tenant_id: str + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.edgeorder.models.UserAssignedIdentity] + """ + + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity type.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """Service Principal Id backing the Msi.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """Home Tenant Id.""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """User Assigned Identities.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceProviderDetails(_Model): + """Management RP details. + + :ivar resource_provider_namespace: Resource provider namespace. + :vartype resource_provider_namespace: str + """ + + resource_provider_namespace: Optional[str] = rest_field(name="resourceProviderNamespace", visibility=["read"]) + """Resource provider namespace.""" + + +class ReturnOrderItemDetails(_Model): + """Return order item request body. + + :ivar return_address: Customer return address. + :vartype return_address: ~azure.mgmt.edgeorder.models.AddressProperties + :ivar return_reason: Return Reason. Required. + :vartype return_reason: str + :ivar service_tag: Service tag (located on the bottom-right corner of the device). + :vartype service_tag: str + :ivar shipping_box_required: Shipping Box required. + :vartype shipping_box_required: bool + """ + + return_address: Optional["_models.AddressProperties"] = rest_field( + name="returnAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer return address.""" + return_reason: str = rest_field(name="returnReason", visibility=["read", "create", "update", "delete", "query"]) + """Return Reason. Required.""" + service_tag: Optional[str] = rest_field( + name="serviceTag", visibility=["read", "create", "update", "delete", "query"] + ) + """Service tag (located on the bottom-right corner of the device).""" + shipping_box_required: Optional[bool] = rest_field( + name="shippingBoxRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """Shipping Box required.""" + + @overload + def __init__( + self, + *, + return_reason: str, + return_address: Optional["_models.AddressProperties"] = None, + service_tag: Optional[str] = None, + shipping_box_required: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReverseShippingDetails(_Model): + """Reverse shipment details. + + :ivar sas_key_for_label: SAS key to download the reverse shipment label of the package. + :vartype sas_key_for_label: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar carrier_display_name: Carrier Name for display purpose. Not to be used for any + processing. + :vartype carrier_display_name: str + :ivar tracking_id: TrackingId of the package. + :vartype tracking_id: str + :ivar tracking_url: TrackingUrl of the package. + :vartype tracking_url: str + """ + + sas_key_for_label: Optional[str] = rest_field(name="sasKeyForLabel", visibility=["read"]) + """SAS key to download the reverse shipment label of the package.""" + carrier_name: Optional[str] = rest_field(name="carrierName", visibility=["read"]) + """Name of the carrier.""" + carrier_display_name: Optional[str] = rest_field(name="carrierDisplayName", visibility=["read"]) + """Carrier Name for display purpose. Not to be used for any processing.""" + tracking_id: Optional[str] = rest_field(name="trackingId", visibility=["read"]) + """TrackingId of the package.""" + tracking_url: Optional[str] = rest_field(name="trackingUrl", visibility=["read"]) + """TrackingUrl of the package.""" + + +class ShippingAddress(_Model): + """Shipping address where customer wishes to receive the device. + + :ivar street_address1: Street Address line 1. + :vartype street_address1: str + :ivar street_address2: Street Address line 2. + :vartype street_address2: str + :ivar street_address3: Street Address line 3. + :vartype street_address3: str + :ivar city: Name of the City. + :vartype city: str + :ivar state_or_province: Name of the State or Province. + :vartype state_or_province: str + :ivar country: Name of the Country. Required. + :vartype country: str + :ivar postal_code: Postal code. + :vartype postal_code: str + :ivar zip_extended_code: Extended Zip Code. + :vartype zip_extended_code: str + :ivar company_name: Name of the company. + :vartype company_name: str + :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". + :vartype address_type: str or ~azure.mgmt.edgeorder.models.AddressType + """ + + street_address1: Optional[str] = rest_field( + name="streetAddress1", visibility=["read", "create", "update", "delete", "query"] + ) + """Street Address line 1.""" + street_address2: Optional[str] = rest_field( + name="streetAddress2", visibility=["read", "create", "update", "delete", "query"] + ) + """Street Address line 2.""" + street_address3: Optional[str] = rest_field( + name="streetAddress3", visibility=["read", "create", "update", "delete", "query"] + ) + """Street Address line 3.""" + city: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the City.""" + state_or_province: Optional[str] = rest_field( + name="stateOrProvince", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the State or Province.""" + country: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Country. Required.""" + postal_code: Optional[str] = rest_field( + name="postalCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Postal code.""" + zip_extended_code: Optional[str] = rest_field( + name="zipExtendedCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Extended Zip Code.""" + company_name: Optional[str] = rest_field( + name="companyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the company.""" + address_type: Optional[Union[str, "_models.AddressType"]] = rest_field( + name="addressType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of address. Known values are: \"None\", \"Residential\", and \"Commercial\".""" + + @overload + def __init__( + self, + *, + country: str, + street_address1: Optional[str] = None, + street_address2: Optional[str] = None, + street_address3: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + zip_extended_code: Optional[str] = None, + company_name: Optional[str] = None, + address_type: Optional[Union[str, "_models.AddressType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SiteDetails(_Model): + """Represents Site Related Details. + + :ivar site_id: Unique Id, Identifying A Site. Required. + :vartype site_id: str + """ + + site_id: str = rest_field(name="siteId", visibility=["read", "create", "update", "delete", "query"]) + """Unique Id, Identifying A Site. Required.""" + + @overload + def __init__( + self, + *, + site_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Specification(_Model): + """Specification of the configurations. + + :ivar name: Name of the specification. + :vartype name: str + :ivar value: Value of the specification. + :vartype value: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the specification.""" + value: Optional[str] = rest_field(visibility=["read"]) + """Value of the specification.""" + + +class StageDetails(_Model): + """Resource stage details. + + :ivar stage_status: Stage status. Known values are: "None", "InProgress", "Succeeded", + "Failed", "Cancelled", and "Cancelling". + :vartype stage_status: str or ~azure.mgmt.edgeorder.models.StageStatus + :ivar stage_name: Stage name. Known values are: "Placed", "InReview", "Confirmed", + "ReadyToShip", "Shipped", "Delivered", "ReadyToSetup", "InUse", "ReturnInitiated", + "ReturnPickedUp", "ReturnedToMicrosoft", "ReturnCompleted", and "Cancelled". + :vartype stage_name: str or ~azure.mgmt.edgeorder.models.StageName + :ivar display_name: Display name of the resource stage. + :vartype display_name: str + :ivar start_time: Stage start time. + :vartype start_time: ~datetime.datetime + """ + + stage_status: Optional[Union[str, "_models.StageStatus"]] = rest_field(name="stageStatus", visibility=["read"]) + """Stage status. Known values are: \"None\", \"InProgress\", \"Succeeded\", \"Failed\", + \"Cancelled\", and \"Cancelling\".""" + stage_name: Optional[Union[str, "_models.StageName"]] = rest_field(name="stageName", visibility=["read"]) + """Stage name. Known values are: \"Placed\", \"InReview\", \"Confirmed\", \"ReadyToShip\", + \"Shipped\", \"Delivered\", \"ReadyToSetup\", \"InUse\", \"ReturnInitiated\", + \"ReturnPickedUp\", \"ReturnedToMicrosoft\", \"ReturnCompleted\", and \"Cancelled\".""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Display name of the resource stage.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Stage start time.""" + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TermCommitmentInformation(_Model): + """Term Commitment Information. + + :ivar term_commitment_type: Term Commitment Type. Required. Known values are: "None", "Trial", + and "Timed". + :vartype term_commitment_type: str or ~azure.mgmt.edgeorder.models.TermCommitmentType + :ivar term_commitment_type_duration: Term Commitment Duration. Currently Supporting P365D, + P1095D. + :vartype term_commitment_type_duration: ~datetime.timedelta + :ivar pending_days_for_term: Number of Days Pending for Term Commitment. + :vartype pending_days_for_term: int + """ + + term_commitment_type: Union[str, "_models.TermCommitmentType"] = rest_field( + name="termCommitmentType", visibility=["read", "create", "update", "delete", "query"] + ) + """Term Commitment Type. Required. Known values are: \"None\", \"Trial\", and \"Timed\".""" + term_commitment_type_duration: Optional[datetime.timedelta] = rest_field( + name="termCommitmentTypeDuration", visibility=["read"] + ) + """Term Commitment Duration. Currently Supporting P365D, P1095D.""" + pending_days_for_term: Optional[int] = rest_field(name="pendingDaysForTerm", visibility=["read"]) + """Number of Days Pending for Term Commitment.""" + + @overload + def __init__( + self, + *, + term_commitment_type: Union[str, "_models.TermCommitmentType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TermCommitmentPreferences(_Model): + """Term Commitment preference received from customer. + + :ivar preferred_term_commitment_type: Term Commitment Type. Required. Known values are: "None", + "Trial", and "Timed". + :vartype preferred_term_commitment_type: str or ~azure.mgmt.edgeorder.models.TermCommitmentType + :ivar preferred_term_commitment_duration: Customer preferred Term Duration. + :vartype preferred_term_commitment_duration: ~datetime.timedelta + """ + + preferred_term_commitment_type: Union[str, "_models.TermCommitmentType"] = rest_field( + name="preferredTermCommitmentType", visibility=["read", "create", "update", "delete", "query"] + ) + """Term Commitment Type. Required. Known values are: \"None\", \"Trial\", and \"Timed\".""" + preferred_term_commitment_duration: Optional[datetime.timedelta] = rest_field( + name="preferredTermCommitmentDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer preferred Term Duration.""" + + @overload + def __init__( + self, + *, + preferred_term_commitment_type: Union[str, "_models.TermCommitmentType"], + preferred_term_commitment_duration: Optional[datetime.timedelta] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TermTypeDetails(_Model): + """Holds details about term type and duration. + + :ivar term_type: Term Commitment Type. Required. Known values are: "None", "Trial", and + "Timed". + :vartype term_type: str or ~azure.mgmt.edgeorder.models.TermCommitmentType + :ivar term_type_duration: Duration for the term type. Required. + :vartype term_type_duration: ~datetime.timedelta + """ + + term_type: Union[str, "_models.TermCommitmentType"] = rest_field( + name="termType", visibility=["read", "create", "update", "delete", "query"] + ) + """Term Commitment Type. Required. Known values are: \"None\", \"Trial\", and \"Timed\".""" + term_type_duration: datetime.timedelta = rest_field( + name="termTypeDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Duration for the term type. Required.""" + + @overload + def __init__( + self, + *, + term_type: Union[str, "_models.TermCommitmentType"], + term_type_duration: datetime.timedelta, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TransportPreferences(_Model): + """Preferences related to the shipment logistics of the sku. + + :ivar preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. + Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :vartype preferred_shipment_type: str or ~azure.mgmt.edgeorder.models.TransportShipmentTypes + """ + + preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"] = rest_field( + name="preferredShipmentType", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates Shipment Logistics type that the customer preferred. Required. Known values are: + \"CustomerManaged\" and \"MicrosoftManaged\".""" + + @overload + def __init__( + self, + *, + preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models_py3.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models_py3.py deleted file mode 100644 index 16c22ff72120..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_models_py3.py +++ /dev/null @@ -1,3147 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AddressDetails(_serialization.Model): - """Address details for an order item. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar forward_address: Customer address and contact details. It should be address resource. - Required. - :vartype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties - :ivar return_address: Return shipping address. - :vartype return_address: ~azure.mgmt.edgeorder.models.AddressProperties - """ - - _validation = { - "forward_address": {"required": True}, - "return_address": {"readonly": True}, - } - - _attribute_map = { - "forward_address": {"key": "forwardAddress", "type": "AddressProperties"}, - "return_address": {"key": "returnAddress", "type": "AddressProperties"}, - } - - def __init__(self, *, forward_address: "_models.AddressProperties", **kwargs: Any) -> None: - """ - :keyword forward_address: Customer address and contact details. It should be address resource. - Required. - :paramtype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties - """ - super().__init__(**kwargs) - self.forward_address = forward_address - self.return_address = None - - -class AddressProperties(_serialization.Model): - """Address Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar shipping_address: Shipping details for the address. - :vartype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :ivar contact_details: Contact details for the address. Required. - :vartype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - :ivar address_validation_status: Status of address validation. Known values are: "Valid", - "Invalid", and "Ambiguous". - :vartype address_validation_status: str or ~azure.mgmt.edgeorder.models.AddressValidationStatus - """ - - _validation = { - "contact_details": {"required": True}, - "address_validation_status": {"readonly": True}, - } - - _attribute_map = { - "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, - "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, - "address_validation_status": {"key": "addressValidationStatus", "type": "str"}, - } - - def __init__( - self, - *, - contact_details: "_models.ContactDetails", - shipping_address: Optional["_models.ShippingAddress"] = None, - **kwargs: Any - ) -> None: - """ - :keyword shipping_address: Shipping details for the address. - :paramtype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :keyword contact_details: Contact details for the address. Required. - :paramtype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - """ - super().__init__(**kwargs) - self.shipping_address = shipping_address - self.contact_details = contact_details - self.address_validation_status = None - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class AddressResource(TrackedResource): - """Address Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar system_data: Represents resource creation and update time. - :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData - :ivar shipping_address: Shipping details for the address. - :vartype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :ivar contact_details: Contact details for the address. Required. - :vartype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - :ivar address_validation_status: Status of address validation. Known values are: "Valid", - "Invalid", and "Ambiguous". - :vartype address_validation_status: str or ~azure.mgmt.edgeorder.models.AddressValidationStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "contact_details": {"required": True}, - "address_validation_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "shipping_address": {"key": "properties.shippingAddress", "type": "ShippingAddress"}, - "contact_details": {"key": "properties.contactDetails", "type": "ContactDetails"}, - "address_validation_status": {"key": "properties.addressValidationStatus", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - contact_details: "_models.ContactDetails", - tags: Optional[Dict[str, str]] = None, - shipping_address: Optional["_models.ShippingAddress"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword shipping_address: Shipping details for the address. - :paramtype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :keyword contact_details: Contact details for the address. Required. - :paramtype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - """ - super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None - self.shipping_address = shipping_address - self.contact_details = contact_details - self.address_validation_status = None - - -class AddressResourceList(_serialization.Model): - """Address Resource Collection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of address resources. - :vartype value: list[~azure.mgmt.edgeorder.models.AddressResource] - :ivar next_link: Link for the next set of job resources. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AddressResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: Link for the next set of job resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class AddressUpdateParameter(_serialization.Model): - """The Address update parameters. - - :ivar tags: The list of key value pairs that describe the resource. These tags can be used in - viewing and grouping this resource (across resource groups). - :vartype tags: dict[str, str] - :ivar shipping_address: Shipping details for the address. - :vartype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :ivar contact_details: Contact details for the address. - :vartype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "shipping_address": {"key": "properties.shippingAddress", "type": "ShippingAddress"}, - "contact_details": {"key": "properties.contactDetails", "type": "ContactDetails"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - shipping_address: Optional["_models.ShippingAddress"] = None, - contact_details: Optional["_models.ContactDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The list of key value pairs that describe the resource. These tags can be used - in viewing and grouping this resource (across resource groups). - :paramtype tags: dict[str, str] - :keyword shipping_address: Shipping details for the address. - :paramtype shipping_address: ~azure.mgmt.edgeorder.models.ShippingAddress - :keyword contact_details: Contact details for the address. - :paramtype contact_details: ~azure.mgmt.edgeorder.models.ContactDetails - """ - super().__init__(**kwargs) - self.tags = tags - self.shipping_address = shipping_address - self.contact_details = contact_details - - -class AvailabilityInformation(_serialization.Model): - """Availability information of a product system. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar availability_stage: Current availability stage of the product. Availability stage. Known - values are: "Available", "ComingSoon", "Preview", "Deprecated", "Signup", and "Unavailable". - :vartype availability_stage: str or ~azure.mgmt.edgeorder.models.AvailabilityStage - :ivar disabled_reason: Reason why the product is disabled. Known values are: "None", "Country", - "Region", "Feature", "OfferType", "NoSubscriptionInfo", "NotAvailable", and "OutOfStock". - :vartype disabled_reason: str or ~azure.mgmt.edgeorder.models.DisabledReason - :ivar disabled_reason_message: Message for why the product is disabled. - :vartype disabled_reason_message: str - """ - - _validation = { - "availability_stage": {"readonly": True}, - "disabled_reason": {"readonly": True}, - "disabled_reason_message": {"readonly": True}, - } - - _attribute_map = { - "availability_stage": {"key": "availabilityStage", "type": "str"}, - "disabled_reason": {"key": "disabledReason", "type": "str"}, - "disabled_reason_message": {"key": "disabledReasonMessage", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.availability_stage = None - self.disabled_reason = None - self.disabled_reason_message = None - - -class BasicInformation(_serialization.Model): - """Basic information for any product system. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - - -class BillingMeterDetails(_serialization.Model): - """Holds billing meter details for each type of billing. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Represents Billing type name. - :vartype name: str - :ivar meter_details: Represents MeterDetails. - :vartype meter_details: ~azure.mgmt.edgeorder.models.MeterDetails - :ivar metering_type: Represents Metering type (eg one-time or recurrent). Known values are: - "OneTime", "Recurring", and "Adhoc". - :vartype metering_type: str or ~azure.mgmt.edgeorder.models.MeteringType - :ivar frequency: Frequency of recurrence. - :vartype frequency: str - """ - - _validation = { - "name": {"readonly": True}, - "meter_details": {"readonly": True}, - "metering_type": {"readonly": True}, - "frequency": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "meter_details": {"key": "meterDetails", "type": "MeterDetails"}, - "metering_type": {"key": "meteringType", "type": "str"}, - "frequency": {"key": "frequency", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.meter_details = None - self.metering_type = None - self.frequency = None - - -class CancellationReason(_serialization.Model): - """Reason for cancellation. - - All required parameters must be populated in order to send to server. - - :ivar reason: Reason for cancellation. Required. - :vartype reason: str - """ - - _validation = { - "reason": {"required": True}, - } - - _attribute_map = { - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, *, reason: str, **kwargs: Any) -> None: - """ - :keyword reason: Reason for cancellation. Required. - :paramtype reason: str - """ - super().__init__(**kwargs) - self.reason = reason - - -class CommonProperties(BasicInformation): - """Represents common properties across product hierarchy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "filterableProperties", "type": "[FilterableProperty]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.filterable_properties = None - - -class Configuration(_serialization.Model): - """Configuration object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar specifications: Specifications of the configuration. - :vartype specifications: list[~azure.mgmt.edgeorder.models.Specification] - :ivar dimensions: Dimensions of the configuration. - :vartype dimensions: ~azure.mgmt.edgeorder.models.Dimensions - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "specifications": {"readonly": True}, - "dimensions": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "Description"}, - "image_information": {"key": "properties.imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "properties.costInformation", "type": "CostInformation"}, - "availability_information": {"key": "properties.availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "properties.hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "properties.filterableProperties", "type": "[FilterableProperty]"}, - "specifications": {"key": "properties.specifications", "type": "[Specification]"}, - "dimensions": {"key": "properties.dimensions", "type": "Dimensions"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - self.filterable_properties = None - self.specifications = None - self.dimensions = None - - -class ConfigurationFilters(_serialization.Model): - """Configuration filters. - - All required parameters must be populated in order to send to server. - - :ivar hierarchy_information: Product hierarchy information. Required. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_property: Filters specific to product. - :vartype filterable_property: list[~azure.mgmt.edgeorder.models.FilterableProperty] - """ - - _validation = { - "hierarchy_information": {"required": True}, - } - - _attribute_map = { - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_property": {"key": "filterableProperty", "type": "[FilterableProperty]"}, - } - - def __init__( - self, - *, - hierarchy_information: "_models.HierarchyInformation", - filterable_property: Optional[List["_models.FilterableProperty"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword hierarchy_information: Product hierarchy information. Required. - :paramtype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :keyword filterable_property: Filters specific to product. - :paramtype filterable_property: list[~azure.mgmt.edgeorder.models.FilterableProperty] - """ - super().__init__(**kwargs) - self.hierarchy_information = hierarchy_information - self.filterable_property = filterable_property - - -class ConfigurationProperties(CommonProperties): - """Properties of configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar specifications: Specifications of the configuration. - :vartype specifications: list[~azure.mgmt.edgeorder.models.Specification] - :ivar dimensions: Dimensions of the configuration. - :vartype dimensions: ~azure.mgmt.edgeorder.models.Dimensions - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "specifications": {"readonly": True}, - "dimensions": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "filterableProperties", "type": "[FilterableProperty]"}, - "specifications": {"key": "specifications", "type": "[Specification]"}, - "dimensions": {"key": "dimensions", "type": "Dimensions"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.specifications = None - self.dimensions = None - - -class Configurations(_serialization.Model): - """The list of configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of configurations. - :vartype value: list[~azure.mgmt.edgeorder.models.Configuration] - :ivar next_link: Link for the next set of configurations. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Configuration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: Link for the next set of configurations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class ConfigurationsRequest(_serialization.Model): - """Configuration request object. - - All required parameters must be populated in order to send to server. - - :ivar configuration_filters: Holds details about product hierarchy information and filterable - property. Required. - :vartype configuration_filters: list[~azure.mgmt.edgeorder.models.ConfigurationFilters] - :ivar customer_subscription_details: Customer subscription properties. Clients can display - available products to unregistered customers by explicitly passing subscription details. - :vartype customer_subscription_details: - ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails - """ - - _validation = { - "configuration_filters": {"required": True, "unique": True}, - } - - _attribute_map = { - "configuration_filters": {"key": "configurationFilters", "type": "[ConfigurationFilters]"}, - "customer_subscription_details": {"key": "customerSubscriptionDetails", "type": "CustomerSubscriptionDetails"}, - } - - def __init__( - self, - *, - configuration_filters: List["_models.ConfigurationFilters"], - customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword configuration_filters: Holds details about product hierarchy information and - filterable property. Required. - :paramtype configuration_filters: list[~azure.mgmt.edgeorder.models.ConfigurationFilters] - :keyword customer_subscription_details: Customer subscription properties. Clients can display - available products to unregistered customers by explicitly passing subscription details. - :paramtype customer_subscription_details: - ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails - """ - super().__init__(**kwargs) - self.configuration_filters = configuration_filters - self.customer_subscription_details = customer_subscription_details - - -class ContactDetails(_serialization.Model): - """Contact Details. - - All required parameters must be populated in order to send to server. - - :ivar contact_name: Contact name of the person. Required. - :vartype contact_name: str - :ivar phone: Phone number of the contact person. Required. - :vartype phone: str - :ivar phone_extension: Phone extension number of the contact person. - :vartype phone_extension: str - :ivar mobile: Mobile number of the contact person. - :vartype mobile: str - :ivar email_list: List of Email-ids to be notified about job progress. Required. - :vartype email_list: list[str] - """ - - _validation = { - "contact_name": {"required": True}, - "phone": {"required": True}, - "email_list": {"required": True}, - } - - _attribute_map = { - "contact_name": {"key": "contactName", "type": "str"}, - "phone": {"key": "phone", "type": "str"}, - "phone_extension": {"key": "phoneExtension", "type": "str"}, - "mobile": {"key": "mobile", "type": "str"}, - "email_list": {"key": "emailList", "type": "[str]"}, - } - - def __init__( - self, - *, - contact_name: str, - phone: str, - email_list: List[str], - phone_extension: Optional[str] = None, - mobile: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword contact_name: Contact name of the person. Required. - :paramtype contact_name: str - :keyword phone: Phone number of the contact person. Required. - :paramtype phone: str - :keyword phone_extension: Phone extension number of the contact person. - :paramtype phone_extension: str - :keyword mobile: Mobile number of the contact person. - :paramtype mobile: str - :keyword email_list: List of Email-ids to be notified about job progress. Required. - :paramtype email_list: list[str] - """ - super().__init__(**kwargs) - self.contact_name = contact_name - self.phone = phone - self.phone_extension = phone_extension - self.mobile = mobile - self.email_list = email_list - - -class CostInformation(_serialization.Model): - """Cost information for the product system. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar billing_meter_details: Details on the various billing aspects for the product system. - :vartype billing_meter_details: list[~azure.mgmt.edgeorder.models.BillingMeterDetails] - :ivar billing_info_url: Default url to display billing information. - :vartype billing_info_url: str - """ - - _validation = { - "billing_meter_details": {"readonly": True}, - "billing_info_url": {"readonly": True}, - } - - _attribute_map = { - "billing_meter_details": {"key": "billingMeterDetails", "type": "[BillingMeterDetails]"}, - "billing_info_url": {"key": "billingInfoUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.billing_meter_details = None - self.billing_info_url = None - - -class CustomerSubscriptionDetails(_serialization.Model): - """Holds Customer subscription details. Clients can display available products to unregistered - customers by explicitly passing subscription details. - - All required parameters must be populated in order to send to server. - - :ivar registered_features: List of registered feature flags for subscription. - :vartype registered_features: - list[~azure.mgmt.edgeorder.models.CustomerSubscriptionRegisteredFeatures] - :ivar location_placement_id: Location placement Id of a subscription. - :vartype location_placement_id: str - :ivar quota_id: Quota ID of a subscription. Required. - :vartype quota_id: str - """ - - _validation = { - "quota_id": {"required": True}, - } - - _attribute_map = { - "registered_features": {"key": "registeredFeatures", "type": "[CustomerSubscriptionRegisteredFeatures]"}, - "location_placement_id": {"key": "locationPlacementId", "type": "str"}, - "quota_id": {"key": "quotaId", "type": "str"}, - } - - def __init__( - self, - *, - quota_id: str, - registered_features: Optional[List["_models.CustomerSubscriptionRegisteredFeatures"]] = None, - location_placement_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword registered_features: List of registered feature flags for subscription. - :paramtype registered_features: - list[~azure.mgmt.edgeorder.models.CustomerSubscriptionRegisteredFeatures] - :keyword location_placement_id: Location placement Id of a subscription. - :paramtype location_placement_id: str - :keyword quota_id: Quota ID of a subscription. Required. - :paramtype quota_id: str - """ - super().__init__(**kwargs) - self.registered_features = registered_features - self.location_placement_id = location_placement_id - self.quota_id = quota_id - - -class CustomerSubscriptionRegisteredFeatures(_serialization.Model): - """Represents subscription registered features. - - :ivar name: Name of subscription registered feature. - :vartype name: str - :ivar state: State of subscription registered feature. - :vartype state: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, state: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Name of subscription registered feature. - :paramtype name: str - :keyword state: State of subscription registered feature. - :paramtype state: str - """ - super().__init__(**kwargs) - self.name = name - self.state = state - - -class Description(_serialization.Model): - """Description related properties of a product system. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar description_type: Type of description. "Base" - :vartype description_type: str or ~azure.mgmt.edgeorder.models.DescriptionType - :ivar short_description: Short description of the product system. - :vartype short_description: str - :ivar long_description: Long description of the product system. - :vartype long_description: str - :ivar keywords: Keywords for the product system. - :vartype keywords: list[str] - :ivar attributes: Attributes for the product system. - :vartype attributes: list[str] - :ivar links: Links for the product system. - :vartype links: list[~azure.mgmt.edgeorder.models.Link] - """ - - _validation = { - "description_type": {"readonly": True}, - "short_description": {"readonly": True}, - "long_description": {"readonly": True}, - "keywords": {"readonly": True}, - "attributes": {"readonly": True}, - "links": {"readonly": True}, - } - - _attribute_map = { - "description_type": {"key": "descriptionType", "type": "str"}, - "short_description": {"key": "shortDescription", "type": "str"}, - "long_description": {"key": "longDescription", "type": "str"}, - "keywords": {"key": "keywords", "type": "[str]"}, - "attributes": {"key": "attributes", "type": "[str]"}, - "links": {"key": "links", "type": "[Link]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.description_type = None - self.short_description = None - self.long_description = None - self.keywords = None - self.attributes = None - self.links = None - - -class DeviceDetails(_serialization.Model): - """Device details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar serial_number: device serial number. - :vartype serial_number: str - :ivar management_resource_id: Management Resource Id. - :vartype management_resource_id: str - :ivar management_resource_tenant_id: Management Resource Tenant ID. - :vartype management_resource_tenant_id: str - """ - - _validation = { - "serial_number": {"readonly": True}, - "management_resource_id": {"readonly": True}, - "management_resource_tenant_id": {"readonly": True}, - } - - _attribute_map = { - "serial_number": {"key": "serialNumber", "type": "str"}, - "management_resource_id": {"key": "managementResourceId", "type": "str"}, - "management_resource_tenant_id": {"key": "managementResourceTenantId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.serial_number = None - self.management_resource_id = None - self.management_resource_tenant_id = None - - -class Dimensions(_serialization.Model): - """Dimensions of a configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar length: Length of the device. - :vartype length: float - :ivar height: Height of the device. - :vartype height: float - :ivar width: Width of the device. - :vartype width: float - :ivar length_height_unit: Unit for the dimensions of length, height and width. Known values - are: "IN", "CM", and "IN". - :vartype length_height_unit: str or ~azure.mgmt.edgeorder.models.LengthHeightUnit - :ivar weight: Weight of the device. - :vartype weight: float - :ivar depth: Depth of the device. - :vartype depth: float - :ivar weight_unit: Unit for the dimensions of weight. Known values are: "LBS" and "KGS". - :vartype weight_unit: str or ~azure.mgmt.edgeorder.models.WeightMeasurementUnit - """ - - _validation = { - "length": {"readonly": True}, - "height": {"readonly": True}, - "width": {"readonly": True}, - "length_height_unit": {"readonly": True}, - "weight": {"readonly": True}, - "depth": {"readonly": True}, - "weight_unit": {"readonly": True}, - } - - _attribute_map = { - "length": {"key": "length", "type": "float"}, - "height": {"key": "height", "type": "float"}, - "width": {"key": "width", "type": "float"}, - "length_height_unit": {"key": "lengthHeightUnit", "type": "str"}, - "weight": {"key": "weight", "type": "float"}, - "depth": {"key": "depth", "type": "float"}, - "weight_unit": {"key": "weightUnit", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.length = None - self.height = None - self.width = None - self.length_height_unit = None - self.weight = None - self.depth = None - self.weight_unit = None - - -class DisplayInfo(_serialization.Model): - """Describes product display information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar product_family_display_name: Product family display name. - :vartype product_family_display_name: str - :ivar configuration_display_name: Configuration display name. - :vartype configuration_display_name: str - """ - - _validation = { - "product_family_display_name": {"readonly": True}, - "configuration_display_name": {"readonly": True}, - } - - _attribute_map = { - "product_family_display_name": {"key": "productFamilyDisplayName", "type": "str"}, - "configuration_display_name": {"key": "configurationDisplayName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.product_family_display_name = None - self.configuration_display_name = None - - -class EncryptionPreferences(_serialization.Model): - """Preferences related to the double encryption. - - :ivar double_encryption_status: Double encryption status as entered by the customer. It is - compulsory to give this parameter if the 'Deny' or 'Disabled' policy is configured. Known - values are: "Disabled" and "Enabled". - :vartype double_encryption_status: str or ~azure.mgmt.edgeorder.models.DoubleEncryptionStatus - """ - - _attribute_map = { - "double_encryption_status": {"key": "doubleEncryptionStatus", "type": "str"}, - } - - def __init__( - self, *, double_encryption_status: Optional[Union[str, "_models.DoubleEncryptionStatus"]] = None, **kwargs: Any - ) -> None: - """ - :keyword double_encryption_status: Double encryption status as entered by the customer. It is - compulsory to give this parameter if the 'Deny' or 'Disabled' policy is configured. Known - values are: "Disabled" and "Enabled". - :paramtype double_encryption_status: str or ~azure.mgmt.edgeorder.models.DoubleEncryptionStatus - """ - super().__init__(**kwargs) - self.double_encryption_status = double_encryption_status - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.edgeorder.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.edgeorder.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.edgeorder.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.edgeorder.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class FilterableProperty(_serialization.Model): - """Different types of filters supported and its values. - - All required parameters must be populated in order to send to server. - - :ivar type: Type of product filter. Required. Known values are: "ShipToCountries" and - "DoubleEncryptionStatus". - :vartype type: str or ~azure.mgmt.edgeorder.models.SupportedFilterTypes - :ivar supported_values: Values to be filtered. Required. - :vartype supported_values: list[str] - """ - - _validation = { - "type": {"required": True}, - "supported_values": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "supported_values": {"key": "supportedValues", "type": "[str]"}, - } - - def __init__( - self, *, type: Union[str, "_models.SupportedFilterTypes"], supported_values: List[str], **kwargs: Any - ) -> None: - """ - :keyword type: Type of product filter. Required. Known values are: "ShipToCountries" and - "DoubleEncryptionStatus". - :paramtype type: str or ~azure.mgmt.edgeorder.models.SupportedFilterTypes - :keyword supported_values: Values to be filtered. Required. - :paramtype supported_values: list[str] - """ - super().__init__(**kwargs) - self.type = type - self.supported_values = supported_values - - -class ForwardShippingDetails(_serialization.Model): - """Forward shipment details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar carrier_name: Name of the carrier. - :vartype carrier_name: str - :ivar carrier_display_name: Carrier Name for display purpose. Not to be used for any - processing. - :vartype carrier_display_name: str - :ivar tracking_id: TrackingId of the package. - :vartype tracking_id: str - :ivar tracking_url: TrackingUrl of the package. - :vartype tracking_url: str - """ - - _validation = { - "carrier_name": {"readonly": True}, - "carrier_display_name": {"readonly": True}, - "tracking_id": {"readonly": True}, - "tracking_url": {"readonly": True}, - } - - _attribute_map = { - "carrier_name": {"key": "carrierName", "type": "str"}, - "carrier_display_name": {"key": "carrierDisplayName", "type": "str"}, - "tracking_id": {"key": "trackingId", "type": "str"}, - "tracking_url": {"key": "trackingUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.carrier_name = None - self.carrier_display_name = None - self.tracking_id = None - self.tracking_url = None - - -class HierarchyInformation(_serialization.Model): - """Holds details about product hierarchy information. - - :ivar product_family_name: Represents product family name that uniquely identifies product - family. - :vartype product_family_name: str - :ivar product_line_name: Represents product line name that uniquely identifies product line. - :vartype product_line_name: str - :ivar product_name: Represents product name that uniquely identifies product. - :vartype product_name: str - :ivar configuration_name: Represents configuration name that uniquely identifies configuration. - :vartype configuration_name: str - """ - - _attribute_map = { - "product_family_name": {"key": "productFamilyName", "type": "str"}, - "product_line_name": {"key": "productLineName", "type": "str"}, - "product_name": {"key": "productName", "type": "str"}, - "configuration_name": {"key": "configurationName", "type": "str"}, - } - - def __init__( - self, - *, - product_family_name: Optional[str] = None, - product_line_name: Optional[str] = None, - product_name: Optional[str] = None, - configuration_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword product_family_name: Represents product family name that uniquely identifies product - family. - :paramtype product_family_name: str - :keyword product_line_name: Represents product line name that uniquely identifies product line. - :paramtype product_line_name: str - :keyword product_name: Represents product name that uniquely identifies product. - :paramtype product_name: str - :keyword configuration_name: Represents configuration name that uniquely identifies - configuration. - :paramtype configuration_name: str - """ - super().__init__(**kwargs) - self.product_family_name = product_family_name - self.product_line_name = product_line_name - self.product_name = product_name - self.configuration_name = configuration_name - - -class ImageInformation(_serialization.Model): - """Image for the product. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar image_type: Type of the image. Known values are: "MainImage", "BulletImage", and - "GenericImage". - :vartype image_type: str or ~azure.mgmt.edgeorder.models.ImageType - :ivar image_url: Url of the image. - :vartype image_url: str - """ - - _validation = { - "image_type": {"readonly": True}, - "image_url": {"readonly": True}, - } - - _attribute_map = { - "image_type": {"key": "imageType", "type": "str"}, - "image_url": {"key": "imageUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.image_type = None - self.image_url = None - - -class Link(_serialization.Model): - """Returns link related to the product. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar link_type: Type of link. Known values are: "Generic", "TermsAndConditions", - "Specification", "Documentation", "KnowMore", and "SignUp". - :vartype link_type: str or ~azure.mgmt.edgeorder.models.LinkType - :ivar link_url: Url of the link. - :vartype link_url: str - """ - - _validation = { - "link_type": {"readonly": True}, - "link_url": {"readonly": True}, - } - - _attribute_map = { - "link_type": {"key": "linkType", "type": "str"}, - "link_url": {"key": "linkUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.link_type = None - self.link_url = None - - -class ManagementResourcePreferences(_serialization.Model): - """Management resource preference to link device. - - :ivar preferred_management_resource_id: Customer preferred Management resource ARM ID. - :vartype preferred_management_resource_id: str - """ - - _attribute_map = { - "preferred_management_resource_id": {"key": "preferredManagementResourceId", "type": "str"}, - } - - def __init__(self, *, preferred_management_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword preferred_management_resource_id: Customer preferred Management resource ARM ID. - :paramtype preferred_management_resource_id: str - """ - super().__init__(**kwargs) - self.preferred_management_resource_id = preferred_management_resource_id - - -class MeterDetails(_serialization.Model): - """Holds details about billing type and its meter guids. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - Pav2MeterDetails, PurchaseMeterDetails - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar billing_type: Represents billing type. Required. Known values are: "Pav2" and "Purchase". - :vartype billing_type: str or ~azure.mgmt.edgeorder.models.BillingType - :ivar multiplier: Billing unit applicable for Pav2 billing. - :vartype multiplier: float - :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". - :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType - """ - - _validation = { - "billing_type": {"required": True}, - "multiplier": {"readonly": True}, - "charging_type": {"readonly": True}, - } - - _attribute_map = { - "billing_type": {"key": "billingType", "type": "str"}, - "multiplier": {"key": "multiplier", "type": "float"}, - "charging_type": {"key": "chargingType", "type": "str"}, - } - - _subtype_map = {"billing_type": {"Pav2": "Pav2MeterDetails", "Purchase": "PurchaseMeterDetails"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.billing_type: Optional[str] = None - self.multiplier = None - self.charging_type = None - - -class NotificationPreference(_serialization.Model): - """Notification preference for a job stage. - - All required parameters must be populated in order to send to server. - - :ivar stage_name: Name of the stage. Required. Known values are: "Shipped" and "Delivered". - :vartype stage_name: str or ~azure.mgmt.edgeorder.models.NotificationStageName - :ivar send_notification: Notification is required or not. Required. - :vartype send_notification: bool - """ - - _validation = { - "stage_name": {"required": True}, - "send_notification": {"required": True}, - } - - _attribute_map = { - "stage_name": {"key": "stageName", "type": "str"}, - "send_notification": {"key": "sendNotification", "type": "bool"}, - } - - def __init__( - self, *, stage_name: Union[str, "_models.NotificationStageName"], send_notification: bool, **kwargs: Any - ) -> None: - """ - :keyword stage_name: Name of the stage. Required. Known values are: "Shipped" and "Delivered". - :paramtype stage_name: str or ~azure.mgmt.edgeorder.models.NotificationStageName - :keyword send_notification: Notification is required or not. Required. - :paramtype send_notification: bool - """ - super().__init__(**kwargs) - self.stage_name = stage_name - self.send_notification = send_notification - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.edgeorder.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.edgeorder.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.edgeorder.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.edgeorder.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.edgeorder.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrderItemDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Order item details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar product_details: Unique identifier for configuration. Required. - :vartype product_details: ~azure.mgmt.edgeorder.models.ProductDetails - :ivar order_item_type: Order item type. Required. Known values are: "Purchase" and "Rental". - :vartype order_item_type: str or ~azure.mgmt.edgeorder.models.OrderItemType - :ivar current_stage: Current Order item Status. - :vartype current_stage: ~azure.mgmt.edgeorder.models.StageDetails - :ivar order_item_stage_history: Order item status history. - :vartype order_item_stage_history: list[~azure.mgmt.edgeorder.models.StageDetails] - :ivar preferences: Customer notification Preferences. - :vartype preferences: ~azure.mgmt.edgeorder.models.Preferences - :ivar forward_shipping_details: Forward Package Shipping details. - :vartype forward_shipping_details: ~azure.mgmt.edgeorder.models.ForwardShippingDetails - :ivar reverse_shipping_details: Reverse Package Shipping details. - :vartype reverse_shipping_details: ~azure.mgmt.edgeorder.models.ReverseShippingDetails - :ivar notification_email_list: Additional notification email list. - :vartype notification_email_list: list[str] - :ivar cancellation_reason: Cancellation reason. - :vartype cancellation_reason: str - :ivar cancellation_status: Describes whether the order item is cancellable or not. Known values - are: "Cancellable", "CancellableWithFee", and "NotCancellable". - :vartype cancellation_status: str or ~azure.mgmt.edgeorder.models.OrderItemCancellationEnum - :ivar deletion_status: Describes whether the order item is deletable or not. Known values are: - "Allowed" and "NotAllowed". - :vartype deletion_status: str or ~azure.mgmt.edgeorder.models.ActionStatusEnum - :ivar return_reason: Return reason. - :vartype return_reason: str - :ivar return_status: Describes whether the order item is returnable or not. Known values are: - "Returnable", "ReturnableWithFee", and "NotReturnable". - :vartype return_status: str or ~azure.mgmt.edgeorder.models.OrderItemReturnEnum - :ivar management_rp_details: Parent RP details - this returns only the first or default parent - RP from the entire list. - :vartype management_rp_details: ~azure.mgmt.edgeorder.models.ResourceProviderDetails - :ivar management_rp_details_list: List of parent RP details supported for configuration. - :vartype management_rp_details_list: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - :ivar error: Top level error for the job. - :vartype error: ~azure.mgmt.edgeorder.models.ErrorDetail - """ - - _validation = { - "product_details": {"required": True}, - "order_item_type": {"required": True}, - "current_stage": {"readonly": True}, - "order_item_stage_history": {"readonly": True}, - "forward_shipping_details": {"readonly": True}, - "reverse_shipping_details": {"readonly": True}, - "cancellation_reason": {"readonly": True}, - "cancellation_status": {"readonly": True}, - "deletion_status": {"readonly": True}, - "return_reason": {"readonly": True}, - "return_status": {"readonly": True}, - "management_rp_details": {"readonly": True}, - "management_rp_details_list": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "product_details": {"key": "productDetails", "type": "ProductDetails"}, - "order_item_type": {"key": "orderItemType", "type": "str"}, - "current_stage": {"key": "currentStage", "type": "StageDetails"}, - "order_item_stage_history": {"key": "orderItemStageHistory", "type": "[StageDetails]"}, - "preferences": {"key": "preferences", "type": "Preferences"}, - "forward_shipping_details": {"key": "forwardShippingDetails", "type": "ForwardShippingDetails"}, - "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, - "notification_email_list": {"key": "notificationEmailList", "type": "[str]"}, - "cancellation_reason": {"key": "cancellationReason", "type": "str"}, - "cancellation_status": {"key": "cancellationStatus", "type": "str"}, - "deletion_status": {"key": "deletionStatus", "type": "str"}, - "return_reason": {"key": "returnReason", "type": "str"}, - "return_status": {"key": "returnStatus", "type": "str"}, - "management_rp_details": {"key": "managementRpDetails", "type": "ResourceProviderDetails"}, - "management_rp_details_list": {"key": "managementRpDetailsList", "type": "[ResourceProviderDetails]"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__( - self, - *, - product_details: "_models.ProductDetails", - order_item_type: Union[str, "_models.OrderItemType"], - preferences: Optional["_models.Preferences"] = None, - notification_email_list: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword product_details: Unique identifier for configuration. Required. - :paramtype product_details: ~azure.mgmt.edgeorder.models.ProductDetails - :keyword order_item_type: Order item type. Required. Known values are: "Purchase" and "Rental". - :paramtype order_item_type: str or ~azure.mgmt.edgeorder.models.OrderItemType - :keyword preferences: Customer notification Preferences. - :paramtype preferences: ~azure.mgmt.edgeorder.models.Preferences - :keyword notification_email_list: Additional notification email list. - :paramtype notification_email_list: list[str] - """ - super().__init__(**kwargs) - self.product_details = product_details - self.order_item_type = order_item_type - self.current_stage = None - self.order_item_stage_history = None - self.preferences = preferences - self.forward_shipping_details = None - self.reverse_shipping_details = None - self.notification_email_list = notification_email_list - self.cancellation_reason = None - self.cancellation_status = None - self.deletion_status = None - self.return_reason = None - self.return_status = None - self.management_rp_details = None - self.management_rp_details_list = None - self.error = None - - -class OrderItemResource(TrackedResource): - """Represents order item contract. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar system_data: Represents resource creation and update time. - :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData - :ivar order_item_details: Represents order item details. Required. - :vartype order_item_details: ~azure.mgmt.edgeorder.models.OrderItemDetails - :ivar address_details: Represents shipping and return address for order item. Required. - :vartype address_details: ~azure.mgmt.edgeorder.models.AddressDetails - :ivar start_time: Start time of order item. - :vartype start_time: ~datetime.datetime - :ivar order_id: Id of the order to which order item belongs to. Required. - :vartype order_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "order_item_details": {"required": True}, - "address_details": {"required": True}, - "start_time": {"readonly": True}, - "order_id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "order_item_details": {"key": "properties.orderItemDetails", "type": "OrderItemDetails"}, - "address_details": {"key": "properties.addressDetails", "type": "AddressDetails"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "order_id": {"key": "properties.orderId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - order_item_details: "_models.OrderItemDetails", - address_details: "_models.AddressDetails", - order_id: str, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword order_item_details: Represents order item details. Required. - :paramtype order_item_details: ~azure.mgmt.edgeorder.models.OrderItemDetails - :keyword address_details: Represents shipping and return address for order item. Required. - :paramtype address_details: ~azure.mgmt.edgeorder.models.AddressDetails - :keyword order_id: Id of the order to which order item belongs to. Required. - :paramtype order_id: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None - self.order_item_details = order_item_details - self.address_details = address_details - self.start_time = None - self.order_id = order_id - - -class OrderItemResourceList(_serialization.Model): - """List of orderItems. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of order item resources. - :vartype value: list[~azure.mgmt.edgeorder.models.OrderItemResource] - :ivar next_link: Link for the next set of order item resources. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OrderItemResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: Link for the next set of order item resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class OrderItemUpdateParameter(_serialization.Model): - """Updates order item parameters. - - :ivar tags: The list of key value pairs that describe the resource. These tags can be used in - viewing and grouping this resource (across resource groups). - :vartype tags: dict[str, str] - :ivar forward_address: Updates forward shipping address and contact details. - :vartype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties - :ivar preferences: Customer preference. - :vartype preferences: ~azure.mgmt.edgeorder.models.Preferences - :ivar notification_email_list: Additional notification email list. - :vartype notification_email_list: list[str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "forward_address": {"key": "properties.forwardAddress", "type": "AddressProperties"}, - "preferences": {"key": "properties.preferences", "type": "Preferences"}, - "notification_email_list": {"key": "properties.notificationEmailList", "type": "[str]"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - forward_address: Optional["_models.AddressProperties"] = None, - preferences: Optional["_models.Preferences"] = None, - notification_email_list: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The list of key value pairs that describe the resource. These tags can be used - in viewing and grouping this resource (across resource groups). - :paramtype tags: dict[str, str] - :keyword forward_address: Updates forward shipping address and contact details. - :paramtype forward_address: ~azure.mgmt.edgeorder.models.AddressProperties - :keyword preferences: Customer preference. - :paramtype preferences: ~azure.mgmt.edgeorder.models.Preferences - :keyword notification_email_list: Additional notification email list. - :paramtype notification_email_list: list[str] - """ - super().__init__(**kwargs) - self.tags = tags - self.forward_address = forward_address - self.preferences = preferences - self.notification_email_list = notification_email_list - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - -class OrderResource(ProxyResource): - """Specifies the properties or parameters for an order. Order is a grouping of one or more order - items. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Represents resource creation and update time. - :vartype system_data: ~azure.mgmt.edgeorder.models.SystemData - :ivar order_item_ids: List of order item ARM Ids which are part of an order. - :vartype order_item_ids: list[str] - :ivar current_stage: Order current status. - :vartype current_stage: ~azure.mgmt.edgeorder.models.StageDetails - :ivar order_stage_history: Order status history. - :vartype order_stage_history: list[~azure.mgmt.edgeorder.models.StageDetails] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "order_item_ids": {"readonly": True}, - "current_stage": {"readonly": True}, - "order_stage_history": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "order_item_ids": {"key": "properties.orderItemIds", "type": "[str]"}, - "current_stage": {"key": "properties.currentStage", "type": "StageDetails"}, - "order_stage_history": {"key": "properties.orderStageHistory", "type": "[StageDetails]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.system_data = None - self.order_item_ids = None - self.current_stage = None - self.order_stage_history = None - - -class OrderResourceList(_serialization.Model): - """List of orders. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of order resources. - :vartype value: list[~azure.mgmt.edgeorder.models.OrderResource] - :ivar next_link: Link for the next set of order resources. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OrderResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: Link for the next set of order resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class Pav2MeterDetails(MeterDetails): - """Billing type PAV2 meter details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar billing_type: Represents billing type. Required. Known values are: "Pav2" and "Purchase". - :vartype billing_type: str or ~azure.mgmt.edgeorder.models.BillingType - :ivar multiplier: Billing unit applicable for Pav2 billing. - :vartype multiplier: float - :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". - :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType - :ivar meter_guid: Validation status of requested data center and transport. - :vartype meter_guid: str - """ - - _validation = { - "billing_type": {"required": True}, - "multiplier": {"readonly": True}, - "charging_type": {"readonly": True}, - "meter_guid": {"readonly": True}, - } - - _attribute_map = { - "billing_type": {"key": "billingType", "type": "str"}, - "multiplier": {"key": "multiplier", "type": "float"}, - "charging_type": {"key": "chargingType", "type": "str"}, - "meter_guid": {"key": "meterGuid", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.billing_type: str = "Pav2" - self.meter_guid = None - - -class Preferences(_serialization.Model): - """Preferences related to the order. - - :ivar notification_preferences: Notification preferences. - :vartype notification_preferences: list[~azure.mgmt.edgeorder.models.NotificationPreference] - :ivar transport_preferences: Preferences related to the shipment logistics of the order. - :vartype transport_preferences: ~azure.mgmt.edgeorder.models.TransportPreferences - :ivar encryption_preferences: Preferences related to the Encryption. - :vartype encryption_preferences: ~azure.mgmt.edgeorder.models.EncryptionPreferences - :ivar management_resource_preferences: Preferences related to the Management resource. - :vartype management_resource_preferences: - ~azure.mgmt.edgeorder.models.ManagementResourcePreferences - """ - - _attribute_map = { - "notification_preferences": {"key": "notificationPreferences", "type": "[NotificationPreference]"}, - "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, - "encryption_preferences": {"key": "encryptionPreferences", "type": "EncryptionPreferences"}, - "management_resource_preferences": { - "key": "managementResourcePreferences", - "type": "ManagementResourcePreferences", - }, - } - - def __init__( - self, - *, - notification_preferences: Optional[List["_models.NotificationPreference"]] = None, - transport_preferences: Optional["_models.TransportPreferences"] = None, - encryption_preferences: Optional["_models.EncryptionPreferences"] = None, - management_resource_preferences: Optional["_models.ManagementResourcePreferences"] = None, - **kwargs: Any - ) -> None: - """ - :keyword notification_preferences: Notification preferences. - :paramtype notification_preferences: list[~azure.mgmt.edgeorder.models.NotificationPreference] - :keyword transport_preferences: Preferences related to the shipment logistics of the order. - :paramtype transport_preferences: ~azure.mgmt.edgeorder.models.TransportPreferences - :keyword encryption_preferences: Preferences related to the Encryption. - :paramtype encryption_preferences: ~azure.mgmt.edgeorder.models.EncryptionPreferences - :keyword management_resource_preferences: Preferences related to the Management resource. - :paramtype management_resource_preferences: - ~azure.mgmt.edgeorder.models.ManagementResourcePreferences - """ - super().__init__(**kwargs) - self.notification_preferences = notification_preferences - self.transport_preferences = transport_preferences - self.encryption_preferences = encryption_preferences - self.management_resource_preferences = management_resource_preferences - - -class Product(_serialization.Model): - """List of Products. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar configurations: List of configurations for the product. - :vartype configurations: list[~azure.mgmt.edgeorder.models.Configuration] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "configurations": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "Description"}, - "image_information": {"key": "properties.imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "properties.costInformation", "type": "CostInformation"}, - "availability_information": {"key": "properties.availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "properties.hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "properties.filterableProperties", "type": "[FilterableProperty]"}, - "configurations": {"key": "properties.configurations", "type": "[Configuration]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - self.filterable_properties = None - self.configurations = None - - -class ProductDetails(_serialization.Model): - """Represents product details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar display_info: Display details of the product. - :vartype display_info: ~azure.mgmt.edgeorder.models.DisplayInfo - :ivar hierarchy_information: Hierarchy of the product which uniquely identifies the product. - Required. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar count: Quantity of the product. - :vartype count: int - :ivar product_double_encryption_status: Double encryption status of the configuration. - Read-only field. Known values are: "Disabled" and "Enabled". - :vartype product_double_encryption_status: str or - ~azure.mgmt.edgeorder.models.DoubleEncryptionStatus - :ivar device_details: list of device details. - :vartype device_details: list[~azure.mgmt.edgeorder.models.DeviceDetails] - """ - - _validation = { - "hierarchy_information": {"required": True}, - "count": {"readonly": True}, - "product_double_encryption_status": {"readonly": True}, - "device_details": {"readonly": True}, - } - - _attribute_map = { - "display_info": {"key": "displayInfo", "type": "DisplayInfo"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "count": {"key": "count", "type": "int"}, - "product_double_encryption_status": {"key": "productDoubleEncryptionStatus", "type": "str"}, - "device_details": {"key": "deviceDetails", "type": "[DeviceDetails]"}, - } - - def __init__( - self, - *, - hierarchy_information: "_models.HierarchyInformation", - display_info: Optional["_models.DisplayInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_info: Display details of the product. - :paramtype display_info: ~azure.mgmt.edgeorder.models.DisplayInfo - :keyword hierarchy_information: Hierarchy of the product which uniquely identifies the product. - Required. - :paramtype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - """ - super().__init__(**kwargs) - self.display_info = display_info - self.hierarchy_information = hierarchy_information - self.count = None - self.product_double_encryption_status = None - self.device_details = None - - -class ProductFamilies(_serialization.Model): - """The list of product families. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of product families. - :vartype value: list[~azure.mgmt.edgeorder.models.ProductFamily] - :ivar next_link: Link for the next set of product families. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ProductFamily]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: Link for the next set of product families. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class ProductFamiliesMetadata(_serialization.Model): - """Holds details about product family metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of product family metadata details. - :vartype value: list[~azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails] - :ivar next_link: Link for the next set of product families. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ProductFamiliesMetadataDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class ProductFamiliesMetadataDetails(_serialization.Model): - """Product families metadata details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar product_lines: List of product lines supported in the product family. - :vartype product_lines: list[~azure.mgmt.edgeorder.models.ProductLine] - :ivar resource_provider_details: Contains details related to resource provider. - :vartype resource_provider_details: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "product_lines": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "Description"}, - "image_information": {"key": "properties.imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "properties.costInformation", "type": "CostInformation"}, - "availability_information": {"key": "properties.availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "properties.hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "properties.filterableProperties", "type": "[FilterableProperty]"}, - "product_lines": {"key": "properties.productLines", "type": "[ProductLine]"}, - "resource_provider_details": {"key": "properties.resourceProviderDetails", "type": "[ResourceProviderDetails]"}, - } - - def __init__( - self, *, resource_provider_details: Optional[List["_models.ResourceProviderDetails"]] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_provider_details: Contains details related to resource provider. - :paramtype resource_provider_details: - list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - self.filterable_properties = None - self.product_lines = None - self.resource_provider_details = resource_provider_details - - -class ProductFamiliesRequest(_serialization.Model): - """The filters for showing the product families. - - All required parameters must be populated in order to send to server. - - :ivar filterable_properties: Dictionary of filterable properties on product family. Required. - :vartype filterable_properties: dict[str, - list[~azure.mgmt.edgeorder.models.FilterableProperty]] - :ivar customer_subscription_details: Customer subscription properties. Clients can display - available products to unregistered customers by explicitly passing subscription details. - :vartype customer_subscription_details: - ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails - """ - - _validation = { - "filterable_properties": {"required": True}, - } - - _attribute_map = { - "filterable_properties": {"key": "filterableProperties", "type": "{[FilterableProperty]}"}, - "customer_subscription_details": {"key": "customerSubscriptionDetails", "type": "CustomerSubscriptionDetails"}, - } - - def __init__( - self, - *, - filterable_properties: Dict[str, List["_models.FilterableProperty"]], - customer_subscription_details: Optional["_models.CustomerSubscriptionDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword filterable_properties: Dictionary of filterable properties on product family. - Required. - :paramtype filterable_properties: dict[str, - list[~azure.mgmt.edgeorder.models.FilterableProperty]] - :keyword customer_subscription_details: Customer subscription properties. Clients can display - available products to unregistered customers by explicitly passing subscription details. - :paramtype customer_subscription_details: - ~azure.mgmt.edgeorder.models.CustomerSubscriptionDetails - """ - super().__init__(**kwargs) - self.filterable_properties = filterable_properties - self.customer_subscription_details = customer_subscription_details - - -class ProductFamily(_serialization.Model): - """Product Family. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar product_lines: List of product lines supported in the product family. - :vartype product_lines: list[~azure.mgmt.edgeorder.models.ProductLine] - :ivar resource_provider_details: Contains details related to resource provider. - :vartype resource_provider_details: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "product_lines": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "Description"}, - "image_information": {"key": "properties.imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "properties.costInformation", "type": "CostInformation"}, - "availability_information": {"key": "properties.availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "properties.hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "properties.filterableProperties", "type": "[FilterableProperty]"}, - "product_lines": {"key": "properties.productLines", "type": "[ProductLine]"}, - "resource_provider_details": {"key": "properties.resourceProviderDetails", "type": "[ResourceProviderDetails]"}, - } - - def __init__( - self, *, resource_provider_details: Optional[List["_models.ResourceProviderDetails"]] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_provider_details: Contains details related to resource provider. - :paramtype resource_provider_details: - list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - self.filterable_properties = None - self.product_lines = None - self.resource_provider_details = resource_provider_details - - -class ProductFamilyProperties(CommonProperties): - """Properties of product family. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar product_lines: List of product lines supported in the product family. - :vartype product_lines: list[~azure.mgmt.edgeorder.models.ProductLine] - :ivar resource_provider_details: Contains details related to resource provider. - :vartype resource_provider_details: list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "product_lines": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "filterableProperties", "type": "[FilterableProperty]"}, - "product_lines": {"key": "productLines", "type": "[ProductLine]"}, - "resource_provider_details": {"key": "resourceProviderDetails", "type": "[ResourceProviderDetails]"}, - } - - def __init__( - self, *, resource_provider_details: Optional[List["_models.ResourceProviderDetails"]] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_provider_details: Contains details related to resource provider. - :paramtype resource_provider_details: - list[~azure.mgmt.edgeorder.models.ResourceProviderDetails] - """ - super().__init__(**kwargs) - self.product_lines = None - self.resource_provider_details = resource_provider_details - - -class ProductLine(_serialization.Model): - """Product line. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar products: List of products in the product line. - :vartype products: list[~azure.mgmt.edgeorder.models.Product] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "products": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "Description"}, - "image_information": {"key": "properties.imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "properties.costInformation", "type": "CostInformation"}, - "availability_information": {"key": "properties.availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "properties.hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "properties.filterableProperties", "type": "[FilterableProperty]"}, - "products": {"key": "properties.products", "type": "[Product]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_name = None - self.description = None - self.image_information = None - self.cost_information = None - self.availability_information = None - self.hierarchy_information = None - self.filterable_properties = None - self.products = None - - -class ProductLineProperties(CommonProperties): - """Properties of product line. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar products: List of products in the product line. - :vartype products: list[~azure.mgmt.edgeorder.models.Product] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "products": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "filterableProperties", "type": "[FilterableProperty]"}, - "products": {"key": "products", "type": "[Product]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.products = None - - -class ProductProperties(CommonProperties): - """Properties of products. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: Display Name for the product system. - :vartype display_name: str - :ivar description: Description related to the product system. - :vartype description: ~azure.mgmt.edgeorder.models.Description - :ivar image_information: Image information for the product system. - :vartype image_information: list[~azure.mgmt.edgeorder.models.ImageInformation] - :ivar cost_information: Cost information for the product system. - :vartype cost_information: ~azure.mgmt.edgeorder.models.CostInformation - :ivar availability_information: Availability information of the product system. - :vartype availability_information: ~azure.mgmt.edgeorder.models.AvailabilityInformation - :ivar hierarchy_information: Hierarchy information of a product. - :vartype hierarchy_information: ~azure.mgmt.edgeorder.models.HierarchyInformation - :ivar filterable_properties: list of filters supported for a product. - :vartype filterable_properties: list[~azure.mgmt.edgeorder.models.FilterableProperty] - :ivar configurations: List of configurations for the product. - :vartype configurations: list[~azure.mgmt.edgeorder.models.Configuration] - """ - - _validation = { - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "image_information": {"readonly": True}, - "cost_information": {"readonly": True}, - "availability_information": {"readonly": True}, - "hierarchy_information": {"readonly": True}, - "filterable_properties": {"readonly": True}, - "configurations": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "Description"}, - "image_information": {"key": "imageInformation", "type": "[ImageInformation]"}, - "cost_information": {"key": "costInformation", "type": "CostInformation"}, - "availability_information": {"key": "availabilityInformation", "type": "AvailabilityInformation"}, - "hierarchy_information": {"key": "hierarchyInformation", "type": "HierarchyInformation"}, - "filterable_properties": {"key": "filterableProperties", "type": "[FilterableProperty]"}, - "configurations": {"key": "configurations", "type": "[Configuration]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.configurations = None - - -class PurchaseMeterDetails(MeterDetails): - """Billing type Purchase meter details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar billing_type: Represents billing type. Required. Known values are: "Pav2" and "Purchase". - :vartype billing_type: str or ~azure.mgmt.edgeorder.models.BillingType - :ivar multiplier: Billing unit applicable for Pav2 billing. - :vartype multiplier: float - :ivar charging_type: Charging type. Known values are: "PerOrder" and "PerDevice". - :vartype charging_type: str or ~azure.mgmt.edgeorder.models.ChargingType - :ivar product_id: Product Id. - :vartype product_id: str - :ivar sku_id: Sku Id. - :vartype sku_id: str - :ivar term_id: Term Id. - :vartype term_id: str - """ - - _validation = { - "billing_type": {"required": True}, - "multiplier": {"readonly": True}, - "charging_type": {"readonly": True}, - "product_id": {"readonly": True}, - "sku_id": {"readonly": True}, - "term_id": {"readonly": True}, - } - - _attribute_map = { - "billing_type": {"key": "billingType", "type": "str"}, - "multiplier": {"key": "multiplier", "type": "float"}, - "charging_type": {"key": "chargingType", "type": "str"}, - "product_id": {"key": "productId", "type": "str"}, - "sku_id": {"key": "skuId", "type": "str"}, - "term_id": {"key": "termId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.billing_type: str = "Purchase" - self.product_id = None - self.sku_id = None - self.term_id = None - - -class ResourceIdentity(_serialization.Model): - """Msi identity details of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Identity type. - :vartype type: str - :ivar principal_id: Service Principal Id backing the Msi. - :vartype principal_id: str - :ivar tenant_id: Home Tenant Id. - :vartype tenant_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword type: Identity type. - :paramtype type: str - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = None - self.tenant_id = None - - -class ResourceProviderDetails(_serialization.Model): - """Management RP details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_provider_namespace: Resource provider namespace. - :vartype resource_provider_namespace: str - """ - - _validation = { - "resource_provider_namespace": {"readonly": True}, - } - - _attribute_map = { - "resource_provider_namespace": {"key": "resourceProviderNamespace", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_provider_namespace = None - - -class ReturnOrderItemDetails(_serialization.Model): - """Return order item request body. - - All required parameters must be populated in order to send to server. - - :ivar return_address: customer return address. - :vartype return_address: ~azure.mgmt.edgeorder.models.AddressProperties - :ivar return_reason: Return Reason. Required. - :vartype return_reason: str - :ivar service_tag: Service tag (located on the bottom-right corner of the device). - :vartype service_tag: str - :ivar shipping_box_required: Shipping Box required. - :vartype shipping_box_required: bool - """ - - _validation = { - "return_reason": {"required": True}, - } - - _attribute_map = { - "return_address": {"key": "returnAddress", "type": "AddressProperties"}, - "return_reason": {"key": "returnReason", "type": "str"}, - "service_tag": {"key": "serviceTag", "type": "str"}, - "shipping_box_required": {"key": "shippingBoxRequired", "type": "bool"}, - } - - def __init__( - self, - *, - return_reason: str, - return_address: Optional["_models.AddressProperties"] = None, - service_tag: Optional[str] = None, - shipping_box_required: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword return_address: customer return address. - :paramtype return_address: ~azure.mgmt.edgeorder.models.AddressProperties - :keyword return_reason: Return Reason. Required. - :paramtype return_reason: str - :keyword service_tag: Service tag (located on the bottom-right corner of the device). - :paramtype service_tag: str - :keyword shipping_box_required: Shipping Box required. - :paramtype shipping_box_required: bool - """ - super().__init__(**kwargs) - self.return_address = return_address - self.return_reason = return_reason - self.service_tag = service_tag - self.shipping_box_required = shipping_box_required - - -class ReverseShippingDetails(_serialization.Model): - """Reverse shipment details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar sas_key_for_label: SAS key to download the reverse shipment label of the package. - :vartype sas_key_for_label: str - :ivar carrier_name: Name of the carrier. - :vartype carrier_name: str - :ivar carrier_display_name: Carrier Name for display purpose. Not to be used for any - processing. - :vartype carrier_display_name: str - :ivar tracking_id: TrackingId of the package. - :vartype tracking_id: str - :ivar tracking_url: TrackingUrl of the package. - :vartype tracking_url: str - """ - - _validation = { - "sas_key_for_label": {"readonly": True}, - "carrier_name": {"readonly": True}, - "carrier_display_name": {"readonly": True}, - "tracking_id": {"readonly": True}, - "tracking_url": {"readonly": True}, - } - - _attribute_map = { - "sas_key_for_label": {"key": "sasKeyForLabel", "type": "str"}, - "carrier_name": {"key": "carrierName", "type": "str"}, - "carrier_display_name": {"key": "carrierDisplayName", "type": "str"}, - "tracking_id": {"key": "trackingId", "type": "str"}, - "tracking_url": {"key": "trackingUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.sas_key_for_label = None - self.carrier_name = None - self.carrier_display_name = None - self.tracking_id = None - self.tracking_url = None - - -class ShippingAddress(_serialization.Model): - """Shipping address where customer wishes to receive the device. - - All required parameters must be populated in order to send to server. - - :ivar street_address1: Street Address line 1. Required. - :vartype street_address1: str - :ivar street_address2: Street Address line 2. - :vartype street_address2: str - :ivar street_address3: Street Address line 3. - :vartype street_address3: str - :ivar city: Name of the City. - :vartype city: str - :ivar state_or_province: Name of the State or Province. - :vartype state_or_province: str - :ivar country: Name of the Country. Required. - :vartype country: str - :ivar postal_code: Postal code. - :vartype postal_code: str - :ivar zip_extended_code: Extended Zip Code. - :vartype zip_extended_code: str - :ivar company_name: Name of the company. - :vartype company_name: str - :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". - :vartype address_type: str or ~azure.mgmt.edgeorder.models.AddressType - """ - - _validation = { - "street_address1": {"required": True}, - "country": {"required": True}, - } - - _attribute_map = { - "street_address1": {"key": "streetAddress1", "type": "str"}, - "street_address2": {"key": "streetAddress2", "type": "str"}, - "street_address3": {"key": "streetAddress3", "type": "str"}, - "city": {"key": "city", "type": "str"}, - "state_or_province": {"key": "stateOrProvince", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "postal_code": {"key": "postalCode", "type": "str"}, - "zip_extended_code": {"key": "zipExtendedCode", "type": "str"}, - "company_name": {"key": "companyName", "type": "str"}, - "address_type": {"key": "addressType", "type": "str"}, - } - - def __init__( - self, - *, - street_address1: str, - country: str, - street_address2: Optional[str] = None, - street_address3: Optional[str] = None, - city: Optional[str] = None, - state_or_province: Optional[str] = None, - postal_code: Optional[str] = None, - zip_extended_code: Optional[str] = None, - company_name: Optional[str] = None, - address_type: Optional[Union[str, "_models.AddressType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword street_address1: Street Address line 1. Required. - :paramtype street_address1: str - :keyword street_address2: Street Address line 2. - :paramtype street_address2: str - :keyword street_address3: Street Address line 3. - :paramtype street_address3: str - :keyword city: Name of the City. - :paramtype city: str - :keyword state_or_province: Name of the State or Province. - :paramtype state_or_province: str - :keyword country: Name of the Country. Required. - :paramtype country: str - :keyword postal_code: Postal code. - :paramtype postal_code: str - :keyword zip_extended_code: Extended Zip Code. - :paramtype zip_extended_code: str - :keyword company_name: Name of the company. - :paramtype company_name: str - :keyword address_type: Type of address. Known values are: "None", "Residential", and - "Commercial". - :paramtype address_type: str or ~azure.mgmt.edgeorder.models.AddressType - """ - super().__init__(**kwargs) - self.street_address1 = street_address1 - self.street_address2 = street_address2 - self.street_address3 = street_address3 - self.city = city - self.state_or_province = state_or_province - self.country = country - self.postal_code = postal_code - self.zip_extended_code = zip_extended_code - self.company_name = company_name - self.address_type = address_type - - -class ShippingDetails(_serialization.Model): - """Package shipping details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar carrier_name: Name of the carrier. - :vartype carrier_name: str - :ivar carrier_display_name: Carrier Name for display purpose. Not to be used for any - processing. - :vartype carrier_display_name: str - :ivar tracking_id: TrackingId of the package. - :vartype tracking_id: str - :ivar tracking_url: TrackingUrl of the package. - :vartype tracking_url: str - """ - - _validation = { - "carrier_name": {"readonly": True}, - "carrier_display_name": {"readonly": True}, - "tracking_id": {"readonly": True}, - "tracking_url": {"readonly": True}, - } - - _attribute_map = { - "carrier_name": {"key": "carrierName", "type": "str"}, - "carrier_display_name": {"key": "carrierDisplayName", "type": "str"}, - "tracking_id": {"key": "trackingId", "type": "str"}, - "tracking_url": {"key": "trackingUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.carrier_name = None - self.carrier_display_name = None - self.tracking_id = None - self.tracking_url = None - - -class Specification(_serialization.Model): - """Specifications of the configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the specification. - :vartype name: str - :ivar value: Value of the specification. - :vartype value: str - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class StageDetails(_serialization.Model): - """Resource stage details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar stage_status: Stage status. Known values are: "None", "InProgress", "Succeeded", - "Failed", "Cancelled", and "Cancelling". - :vartype stage_status: str or ~azure.mgmt.edgeorder.models.StageStatus - :ivar stage_name: Stage name. Known values are: "Placed", "InReview", "Confirmed", - "ReadyToShip", "Shipped", "Delivered", "InUse", "ReturnInitiated", "ReturnPickedUp", - "ReturnedToMicrosoft", "ReturnCompleted", and "Cancelled". - :vartype stage_name: str or ~azure.mgmt.edgeorder.models.StageName - :ivar display_name: Display name of the resource stage. - :vartype display_name: str - :ivar start_time: Stage start time. - :vartype start_time: ~datetime.datetime - """ - - _validation = { - "stage_status": {"readonly": True}, - "stage_name": {"readonly": True}, - "display_name": {"readonly": True}, - "start_time": {"readonly": True}, - } - - _attribute_map = { - "stage_status": {"key": "stageStatus", "type": "str"}, - "stage_name": {"key": "stageName", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.stage_status = None - self.stage_name = None - self.display_name = None - self.start_time = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.edgeorder.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TransportPreferences(_serialization.Model): - """Preferences related to the shipment logistics of the sku. - - All required parameters must be populated in order to send to server. - - :ivar preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. - Required. Known values are: "CustomerManaged" and "MicrosoftManaged". - :vartype preferred_shipment_type: str or ~azure.mgmt.edgeorder.models.TransportShipmentTypes - """ - - _validation = { - "preferred_shipment_type": {"required": True}, - } - - _attribute_map = { - "preferred_shipment_type": {"key": "preferredShipmentType", "type": "str"}, - } - - def __init__(self, *, preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], **kwargs: Any) -> None: - """ - :keyword preferred_shipment_type: Indicates Shipment Logistics type that the customer - preferred. Required. Known values are: "CustomerManaged" and "MicrosoftManaged". - :paramtype preferred_shipment_type: str or ~azure.mgmt.edgeorder.models.TransportShipmentTypes - """ - super().__init__(**kwargs) - self.preferred_shipment_type = preferred_shipment_type diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_patch.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_patch.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/__init__.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/__init__.py index 9e856f64458f..53d9e1a63168 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/__init__.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/__init__.py @@ -2,18 +2,34 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._edge_order_management_client_operations import EdgeOrderManagementClientOperationsMixin +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import AddressResourcesOperations # type: ignore +from ._operations import OrderItemResourcesOperations # type: ignore +from ._operations import OrderResourcesOperations # type: ignore +from ._operations import ProductsAndConfigurationsOperationGroupOperations # type: ignore +from ._operations import OrdersOperationGroupOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "EdgeOrderManagementClientOperationsMixin", + "Operations", + "AddressResourcesOperations", + "OrderItemResourcesOperations", + "OrderResourcesOperations", + "ProductsAndConfigurationsOperationGroupOperations", + "OrdersOperationGroupOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_edge_order_management_client_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_operations.py similarity index 58% rename from sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_edge_order_management_client_operations.py rename to sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_operations.py index d58ec28e1841..086b6e82cdc5 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_edge_order_management_client_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_operations.py @@ -1,20 +1,23 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import json +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import MatchConditions, PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, + ResourceModifiedError, ResourceNotFoundError, ResourceNotModifiedError, StreamClosedError, @@ -31,29 +34,28 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import EdgeOrderManagementClientMixinABC +from .._configuration import EdgeOrderClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import prep_if_match, prep_if_none_match -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_operations_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.EdgeOrder/operations") + _url = "/providers/Microsoft.EdgeOrder/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -64,29 +66,27 @@ def build_list_operations_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_addresses_at_subscription_level_request( # pylint: disable=name-too-long - subscription_id: str, *, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any +def build_address_resources_get_request( + resource_group_name: str, address_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses") + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "addressName": _SERIALIZER.url("address_name", address_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -94,125 +94,140 @@ def build_list_addresses_at_subscription_level_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_product_families_request( - subscription_id: str, *, expand: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any +def build_address_resources_create_request( + resource_group_name: str, address_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "addressName": _SERIALIZER.url("address_name", address_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_configurations_request( - subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any +def build_address_resources_update_request( + resource_group_name: str, + address_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "addressName": _SERIALIZER.url("address_name", address_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_product_families_metadata_request( # pylint: disable=name-too-long - subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any +def build_address_resources_delete_request( + resource_group_name: str, address_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata" - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "addressName": _SERIALIZER.url("address_name", address_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_order_at_subscription_level_request( # pylint: disable=name-too-long - subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any +def build_address_resources_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders") + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -220,24 +235,24 @@ def build_list_order_at_subscription_level_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_order_items_at_subscription_level_request( # pylint: disable=name-too-long +def build_address_resources_list_by_subscription_request( # pylint: disable=name-too-long subscription_id: str, *, filter: Optional[str] = None, - expand: Optional[str] = None, skip_token: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems") + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -246,10 +261,10 @@ def build_list_order_items_at_subscription_level_request( # pylint: disable=nam _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") if skip_token is not None: _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -257,40 +272,29 @@ def build_list_order_items_at_subscription_level_request( # pylint: disable=nam return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_addresses_at_resource_group_level_request( # pylint: disable=name-too-long - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any +def build_order_item_resources_get_request( + resource_group_name: str, order_item_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -298,28 +302,22 @@ def build_list_addresses_at_resource_group_level_request( # pylint: disable=nam return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_address_by_name_request( - address_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_order_item_resources_create_request( # pylint: disable=name-too-long + resource_group_name: str, order_item_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" path_format_arguments = { - "addressName": _SERIALIZER.url( - "address_name", address_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -328,34 +326,35 @@ def build_get_address_by_name_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_address_request( - address_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_order_item_resources_update_request( # pylint: disable=name-too-long + resource_group_name: str, + order_item_name: str, + subscription_id: str, + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" path_format_arguments = { - "addressName": _SERIALIZER.url( - "address_name", address_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -367,32 +366,31 @@ def build_create_address_request( if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_address_by_name_request( - address_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_order_item_resources_delete_request( # pylint: disable=name-too-long + resource_group_name: str, order_item_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}" path_format_arguments = { - "addressName": _SERIALIZER.url( - "address_name", address_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -406,73 +404,81 @@ def build_delete_address_by_name_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_address_request( - address_name: str, resource_group_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any +def build_order_item_resources_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems" path_format_arguments = { - "addressName": _SERIALIZER.url( - "address_name", address_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_order_at_resource_group_level_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any +def build_order_item_resources_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") if skip_token is not None: _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -480,27 +486,22 @@ def build_list_order_at_resource_group_level_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_order_by_name_request( - order_name: str, resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +def build_order_item_resources_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, order_item_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel" path_format_arguments = { - "orderName": _SERIALIZER.url("order_name", order_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -509,83 +510,66 @@ def build_get_order_by_name_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_order_items_at_resource_group_level_request( # pylint: disable=name-too-long - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - expand: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any +def build_order_item_resources_return_order_item_request( # pylint: disable=name-too-long + resource_group_name: str, order_item_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_order_item_by_name_request( - order_item_name: str, resource_group_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_order_resources_get_request( + resource_group_name: str, location: str, order_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName}" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "orderName": _SERIALIZER.url("order_name", order_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -593,209 +577,195 @@ def build_get_order_item_by_name_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_order_item_request( - order_item_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_products_and_configurations_operation_group_list_configurations_request( # pylint: disable=name-too-long + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_order_item_by_name_request( - order_item_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_products_and_configurations_operation_group_list_product_families_request( # pylint: disable=name-too-long + subscription_id: str, *, expand: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_order_item_request( - order_item_name: str, - resource_group_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any +def build_products_and_configurations_operation_group_list_product_families_metadata_request( # pylint: disable=name-too-long + subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_cancel_order_item_request( - order_item_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_orders_operation_group_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, skip_token: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/cancel", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_return_order_item_request( - order_item_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +def build_orders_operation_group_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}/return", - ) # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders" path_format_arguments = { - "orderItemName": _SERIALIZER.url("order_item_name", order_item_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -class EdgeOrderManagementClientOperationsMixin( # pylint: disable=too-many-public-methods - EdgeOrderManagementClientMixinABC -): + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """This method gets all the operations that are exposed for customer. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -806,12 +776,17 @@ def list_operations(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_operations_request( - api_version=api_version, + _request = build_operations_list_request( + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -826,16 +801,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -848,36 +828,47 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + +class AddressResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`address_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list_addresses_at_subscription_level( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AddressResource"]: - """Lists all the addresses available under the subscription. + def get(self, resource_group_name: str, address_name: str, **kwargs: Any) -> _models.AddressResource: + """Get information about the specified address. - :param filter: $filter is supported to filter based on shipping address properties. Filter - supports only equals operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on Get list of addresses, which provides the next - page in the list of addresses. Default value is None. - :type skip_token: str - :return: An iterator like instance of either AddressResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.AddressResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :return: AddressResource. The AddressResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.AddressResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,473 +876,571 @@ def list_addresses_at_subscription_level( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_list_addresses_at_subscription_level_request( - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_address_resources_get_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = self._deserialize("AddressResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def list_product_families( - self, - product_families_request: _models.ProductFamiliesRequest, - expand: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. - - :param product_families_request: Filters for showing the product families. Required. - :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AddressResource, response.json()) - @overload - def list_product_families( - self, - product_families_request: IO[bytes], - expand: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param product_families_request: Filters for showing the product families. Required. - :type product_families_request: IO[bytes] - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @distributed_trace - def list_product_families( + def _create_initial( self, - product_families_request: Union[_models.ProductFamiliesRequest, IO[bytes]], - expand: Optional[str] = None, - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: Union[_models.AddressResource, JSON, IO[bytes]], **kwargs: Any - ) -> Iterable["_models.ProductFamily"]: - """This method provides the list of product families for the given subscription. - - :param product_families_request: Filters for showing the product families. Is either a - ProductFamiliesRequest type or a IO[bytes] type. Required. - :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest or - IO[bytes] - :param expand: $expand is supported on configurations parameter for product, which provides - details on the configurations for the product. Default value is None. - :type expand: str - :param skip_token: $skipToken is supported on list of product families, which provides the next - page in the list of product families. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProductFamily or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProductFamilies] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" - _json = None _content = None - if isinstance(product_families_request, (IOBase, bytes)): - _content = product_families_request + if isinstance(address_resource, (IOBase, bytes)): + _content = address_resource else: - _json = self._serialize.body(product_families_request, "ProductFamiliesRequest") + _content = json.dumps(address_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - def prepare_request(next_link=None): - if not next_link: + _request = build_address_resources_create_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_list_product_families_request( - subscription_id=self._config.subscription_id, - expand=expand, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + response = pipeline_response.http_response - def extract_data(pipeline_response): - deserialized = self._deserialize("ProductFamilies", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + deserialized = response.iter_bytes() - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return pipeline_response + return deserialized # type: ignore - return ItemPaged(get_next, extract_data) + @overload + def begin_create( + self, + resource_group_name: str, + address_name: str, + address_resource: _models.AddressResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload - def list_configurations( + def begin_create( self, - configurations_request: _models.ConfigurationsRequest, - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> LROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Required. - :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def list_configurations( + def begin_create( self, - configurations_request: IO[bytes], - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> LROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Required. - :type configurations_request: IO[bytes] - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Required. + :type address_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def list_configurations( + def begin_create( self, - configurations_request: Union[_models.ConfigurationsRequest, IO[bytes]], - skip_token: Optional[str] = None, + resource_group_name: str, + address_name: str, + address_resource: Union[_models.AddressResource, JSON, IO[bytes]], **kwargs: Any - ) -> Iterable["_models.Configuration"]: - """This method provides the list of configurations for the given product family, product line and - product under subscription. + ) -> LROPoller[None]: + """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. - :param configurations_request: Filters for showing the configurations. Is either a - ConfigurationsRequest type or a IO[bytes] type. Required. - :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest or IO[bytes] - :param skip_token: $skipToken is supported on list of configurations, which provides the next - page in the list of configurations. Default value is None. - :type skip_token: str - :return: An iterator like instance of either Configuration or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_resource: Address details from request body. Is one of the following types: + AddressResource, JSON, IO[bytes] Required. + :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configurations] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + address_name=address_name, + address_resource=address_resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(configurations_request, (IOBase, bytes)): - _content = configurations_request - else: - _json = self._serialize.body(configurations_request, "ConfigurationsRequest") + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def prepare_request(next_link=None): - if not next_link: + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _request = build_list_configurations_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("Configurations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def get_next(next_link=None): - _request = prepare_request(next_link) + def _update_initial( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: Union[_models.AddressUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - return pipeline_response + content_type = content_type or "application/json" + _content = None + if isinstance(address_update_parameter, (IOBase, bytes)): + _content = address_update_parameter + else: + _content = json.dumps(address_update_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return ItemPaged(get_next, extract_data) + _request = build_address_resources_update_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @distributed_trace - def list_product_families_metadata( - self, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ProductFamiliesMetadataDetails"]: - """This method provides the list of product families metadata for the given subscription. + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - :param skip_token: $skipToken is supported on list of product families metadata, which provides - the next page in the list of product families metadata. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ProductFamiliesMetadataDetails or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + response = pipeline_response.http_response - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ProductFamiliesMetadata] = kwargs.pop("cls", None) + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def prepare_request(next_link=None): - if not next_link: + deserialized = response.iter_bytes() - _request = build_list_product_families_metadata_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + return deserialized # type: ignore - def extract_data(pipeline_response): - deserialized = self._deserialize("ProductFamiliesMetadata", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + @overload + def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: _models.AddressUpdateParameter, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AddressResource]: + """Update the properties of an existing address. - def get_next(next_link=None): - _request = prepare_request(next_link) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AddressResource]: + """Update the properties of an existing address. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AddressResource]: + """Update the properties of an existing address. - return ItemPaged(get_next, extract_data) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Required. + :type address_update_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_order_at_subscription_level( - self, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.OrderResource"]: - """Lists order at subscription level. + def begin_update( + self, + resource_group_name: str, + address_name: str, + address_update_parameter: Union[_models.AddressUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.AddressResource]: + """Update the properties of an existing address. - :param skip_token: $skipToken is supported on Get list of order, which provides the next page - in the list of order. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :param address_update_parameter: Address update parameters from request body. Is one of the + following types: AddressUpdateParameter, JSON, IO[bytes] Required. + :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter or JSON or + IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns AddressResource. The AddressResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + address_name=address_name, + address_update_parameter=address_update_parameter, + etag=etag, + match_condition=match_condition, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AddressResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AddressResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AddressResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _delete_initial(self, resource_group_name: str, address_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1359,93 +1448,145 @@ def list_order_at_subscription_level( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_list_order_at_subscription_level_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_address_resources_delete_request( + resource_group_name=resource_group_name, + address_name=address_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = self._deserialize("OrderResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, address_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete an address. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param address_name: 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. Required. + :type address_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + address_name=address_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_order_items_at_subscription_level( + def list_by_resource_group( self, + resource_group_name: str, + *, filter: Optional[str] = None, - expand: Optional[str] = None, skip_token: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.OrderItemResource"]: - """Lists order item at subscription level. - - :param filter: $filter is supported to filter based on order id. Filter supports only equals - operation. Default value is None. - :type filter: str - :param expand: $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. Default value is - None. - :type expand: str - :param skip_token: $skipToken is supported on Get list of order items, which provides the next - page in the list of order items. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderItemResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] + ) -> Iterable["_models.AddressResource"]: + """List all the addresses available under the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword filter: $filter is supported to filter based on shipping address properties. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword skip_token: $skipToken is supported on Get list of addresses, which provides the next + page in the list of addresses. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of AddressResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AddressResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1456,16 +1597,22 @@ def list_order_items_at_subscription_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_items_at_subscription_level_request( + _request = build_address_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, - expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1480,16 +1627,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OrderItemResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AddressResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -1502,7 +1654,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1510,31 +1662,35 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_addresses_at_resource_group_level( - self, resource_group_name: str, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any + def list_by_subscription( + self, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any ) -> Iterable["_models.AddressResource"]: - """Lists all the addresses available under the given resource group. + """List all the addresses available under the subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: $filter is supported to filter based on shipping address properties. Filter + :keyword filter: $filter is supported to filter based on shipping address properties. Filter supports only equals operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on Get list of addresses, which provides the next - page in the list of address. Default value is None. - :type skip_token: str - :return: An iterator like instance of either AddressResource or the result of cls(response) + :paramtype filter: str + :keyword skip_token: $skipToken is supported on Get list of addresses, which provides the next + page in the list of addresses. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of AddressResource :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.AddressResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AddressResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1545,16 +1701,21 @@ def list_addresses_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_addresses_at_resource_group_level_request( - resource_group_name=resource_group_name, + _request = build_address_resources_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -1569,16 +1730,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("AddressResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AddressResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -1591,31 +1757,54 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + +class OrderItemResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`order_item_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def get_address_by_name( - self, address_name: str, resource_group_name: str, **kwargs: Any - ) -> _models.AddressResource: - """Gets information about the specified address. + def get( + self, resource_group_name: str, order_item_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.OrderItemResource: + """Get an order item. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: AddressResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.AddressResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :return: OrderItemResource. The OrderItemResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.OrderItemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1624,22 +1813,25 @@ def get_address_by_name( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) - _request = build_get_address_by_name_request( - address_name=address_name, + _request = build_order_item_resources_get_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, + expand=expand, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1647,25 +1839,33 @@ def get_address_by_name( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OrderItemResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_address_initial( + def _create_initial( self, - address_name: str, resource_group_name: str, - address_resource: Union[_models.AddressResource, IO[bytes]], + order_item_name: str, + order_item_resource: Union[_models.OrderItemResource, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,34 +1874,33 @@ def _create_address_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None - if isinstance(address_resource, (IOBase, bytes)): - _content = address_resource + if isinstance(order_item_resource, (IOBase, bytes)): + _content = order_item_resource else: - _json = self._serialize.body(address_resource, "AddressResource") + _content = json.dumps(order_item_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_create_address_request( - address_name=address_name, + _request = build_order_item_resources_create_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1715,119 +1914,145 @@ def _create_address_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_address( + def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: _models.AddressResource, + order_item_name: str, + order_item_resource: _models.OrderItemResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> LROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Required. - :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_address( + def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: IO[bytes], + order_item_name: str, + order_item_resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> LROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Required. - :type address_resource: IO[bytes] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + order_item_name: str, + order_item_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item + API. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Required. + :type order_item_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_address( + def begin_create( self, - address_name: str, resource_group_name: str, - address_resource: Union[_models.AddressResource, IO[bytes]], + order_item_name: str, + order_item_resource: Union[_models.OrderItemResource, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Creates a new address with the specified parameters. Existing address can be updated with this + ) -> LROPoller[None]: + """Create an order item. Existing order item cannot be updated with this api and should instead be + updated with the Update order item API. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_resource: Address details from request body. Is either a AddressResource type or - a IO[bytes] type. Required. - :type address_resource: ~azure.mgmt.edgeorder.models.AddressResource or IO[bytes] - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_resource: Order item details from request body. Is one of the following + types: OrderItemResource, JSON, IO[bytes] Required. + :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_address_initial( - address_name=address_name, + raw_result = self._create_initial( resource_group_name=resource_group_name, - address_resource=address_resource, - api_version=api_version, + order_item_name=order_item_name, + order_item_resource=order_item_resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -1837,57 +2062,85 @@ def begin_create_address( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.AddressResource].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AddressResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_address_by_name_initial( - self, address_name: str, resource_group_name: str, **kwargs: Any + def _update_initial( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: Union[_models.OrderItemUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_address_by_name_request( - address_name=address_name, + content_type = content_type or "application/json" + _content = None + if isinstance(order_item_update_parameter, (IOBase, bytes)): + _content = order_item_update_parameter + else: + _content = json.dumps(order_item_update_parameter, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_order_item_resources_update_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1895,52 +2148,180 @@ def _delete_address_by_name_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: _models.OrderItemUpdateParameter, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: JSON, + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: IO[bytes], + *, + content_type: str = "application/json", + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Required. + :type order_item_update_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete_address_by_name( - self, address_name: str, resource_group_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an address. + def begin_update( + self, + resource_group_name: str, + order_item_name: str, + order_item_update_parameter: Union[_models.OrderItemUpdateParameter, JSON, IO[bytes]], + *, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> LROPoller[_models.OrderItemResource]: + """Update the properties of an existing order item. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param order_item_update_parameter: Order item update parameters from request body. Is one of + the following types: OrderItemUpdateParameter, JSON, IO[bytes] Required. + :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter or + JSON or IO[bytes] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An instance of LROPoller that returns OrderItemResource. The OrderItemResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_address_by_name_initial( - address_name=address_name, + raw_result = self._update_initial( resource_group_name=resource_group_name, - api_version=api_version, + order_item_name=order_item_name, + order_item_update_parameter=order_item_update_parameter, + etag=etag, + match_condition=match_condition, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1949,34 +2330,38 @@ def begin_delete_address_by_name( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OrderItemResource, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.OrderItemResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.OrderItemResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_address_initial( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: Union[_models.AddressUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _delete_initial(self, resource_group_name: str, order_item_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1984,36 +2369,24 @@ def _update_address_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(address_update_parameter, (IOBase, bytes)): - _content = address_update_parameter - else: - _json = self._serialize.body(address_update_parameter, "AddressUpdateParameter") - - _request = build_update_address_request( - address_name=address_name, + _request = build_order_item_resources_delete_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2021,137 +2394,51 @@ def _update_address_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: _models.AddressUpdateParameter, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Updates the properties of an existing address. - - :param address_name: 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. Required. - :type address_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Required. - :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Updates the properties of an existing address. - - :param address_name: 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. Required. - :type address_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Required. - :type address_update_parameter: IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update_address( - self, - address_name: str, - resource_group_name: str, - address_update_parameter: Union[_models.AddressUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.AddressResource]: - """Updates the properties of an existing address. + def begin_delete(self, resource_group_name: str, order_item_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete an order item. - :param address_name: 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. Required. - :type address_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param address_update_parameter: Address update parameters from request body. Is either a - AddressUpdateParameter type or a IO[bytes] type. Required. - :type address_update_parameter: ~azure.mgmt.edgeorder.models.AddressUpdateParameter or - IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the job on the server matches this value. Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either AddressResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.AddressResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AddressResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_address_initial( - address_name=address_name, + raw_result = self._delete_initial( resource_group_name=resource_group_name, - address_update_parameter=address_update_parameter, - if_match=if_match, - api_version=api_version, - content_type=content_type, + order_item_name=order_item_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -2160,52 +2447,73 @@ def begin_update_address( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AddressResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.AddressResource].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AddressResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_order_at_resource_group_level( - self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.OrderResource"]: - """Lists order at resource group level. + def list_by_resource_group( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.OrderItemResource"]: + """List order items at resource group level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param skip_token: $skipToken is supported on Get list of order, which provides the next page - in the list of order. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderResource] + :keyword filter: $filter is supported to filter based on order id and order Item Type. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on Get list of order items, which provides the + next page in the list of order items. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderItemResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OrderItemResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2216,15 +2524,23 @@ def list_order_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_at_resource_group_level_request( + _request = build_order_item_resources_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -2239,16 +2555,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OrderResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderItemResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -2261,7 +2582,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2269,103 +2590,43 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_order_by_name( - self, order_name: str, resource_group_name: str, location: str, **kwargs: Any - ) -> _models.OrderResource: - """Gets an order. - - :param order_name: The name of the order. Required. - :type order_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :return: OrderResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.OrderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) - - _request = build_get_order_by_name_request( - order_name=order_name, - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OrderResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_order_items_at_resource_group_level( + def list_by_subscription( self, - resource_group_name: str, + *, filter: Optional[str] = None, expand: Optional[str] = None, skip_token: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any ) -> Iterable["_models.OrderItemResource"]: - """Lists order item at resource group level. + """List order items at subscription level. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: $filter is supported to filter based on order id. Filter supports only equals - operation. Default value is None. - :type filter: str - :param expand: $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. Default value is - None. - :type expand: str - :param skip_token: $skipToken is supported on Get list of order items, which provides the next - page in the list of order items. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OrderItemResource or the result of cls(response) + :keyword filter: $filter is supported to filter based on order id and order Item Type. Filter + supports only equals operation. Default value is None. + :paramtype filter: str + :keyword expand: $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. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on Get list of order items, which provides the + next page in the list of order items. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderItemResource :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderItemResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResourceList] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OrderItemResource]] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2376,17 +2637,22 @@ def list_order_items_at_resource_group_level( def prepare_request(next_link=None): if not next_link: - _request = build_list_order_items_at_resource_group_level_request( - resource_group_name=resource_group_name, + _request = build_order_item_resources_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, expand=expand, skip_token=skip_token, - api_version=api_version, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -2401,16 +2667,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OrderItemResourceList", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderItemResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -2423,35 +2694,117 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - @distributed_trace - def get_order_item_by_name( - self, order_item_name: str, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> _models.OrderItemResource: - """Gets an order item. + @overload + def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :param order_item_name: The name of the order item. Required. :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Cancel order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param expand: $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. Default value is - None. - :type expand: str - :return: OrderItemResource or the result of cls(response) - :rtype: ~azure.mgmt.edgeorder.models.OrderItemResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + order_item_name: str, + cancellation_reason: Union[_models.CancellationReason, JSON, IO[bytes]], + **kwargs: Any + ) -> None: + """Cancel order item. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param cancellation_reason: Reason for cancellation. Is one of the following types: + CancellationReason, JSON, IO[bytes] Required. + :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason or JSON or IO[bytes] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2459,22 +2812,33 @@ def get_order_item_by_name( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_get_order_item_by_name_request( - order_item_name=order_item_name, + content_type = content_type or "application/json" + _content = None + if isinstance(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _content = json.dumps(cancellation_reason, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_order_item_resources_cancel_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -2483,26 +2847,22 @@ def get_order_item_by_name( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - def _create_order_item_initial( + def _return_order_item_initial( self, - order_item_name: str, resource_group_name: str, - order_item_resource: Union[_models.OrderItemResource, IO[bytes]], + order_item_name: str, + return_order_item_details: Union[_models.ReturnOrderItemDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2511,34 +2871,33 @@ def _create_order_item_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None - if isinstance(order_item_resource, (IOBase, bytes)): - _content = order_item_resource + if isinstance(return_order_item_details, (IOBase, bytes)): + _content = return_order_item_details else: - _json = self._serialize.body(order_item_resource, "OrderItemResource") + _content = json.dumps(return_order_item_details, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_create_order_item_request( - order_item_name=order_item_name, + _request = build_order_item_resources_return_order_item_request( resource_group_name=resource_group_name, + order_item_name=order_item_name, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2552,113 +2911,142 @@ def _create_order_item_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_order_item( + def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: _models.OrderItemResource, + order_item_name: str, + return_order_item_details: _models.ReturnOrderItemDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> LROPoller[_models.OkResponse]: + """Return order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :param order_item_name: The name of the order item. Required. :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OkResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_return_order_item( + self, + resource_group_name: str, + order_item_name: str, + return_order_item_details: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OkResponse]: + """Return order item. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Required. - :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_order_item( + def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: IO[bytes], + order_item_name: str, + return_order_item_details: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> LROPoller[_models.OkResponse]: + """Return order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Required. - :type order_item_resource: IO[bytes] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Required. + :type return_order_item_details: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_order_item( + def begin_return_order_item( self, - order_item_name: str, resource_group_name: str, - order_item_resource: Union[_models.OrderItemResource, IO[bytes]], + order_item_name: str, + return_order_item_details: Union[_models.ReturnOrderItemDetails, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Creates an order item. Existing order item cannot be updated with this api and should instead - be updated with the Update order item API. + ) -> LROPoller[_models.OkResponse]: + """Return order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param order_item_resource: Order item details from request body. Is either a OrderItemResource - type or a IO[bytes] type. Required. - :type order_item_resource: ~azure.mgmt.edgeorder.models.OrderItemResource or IO[bytes] - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :param order_item_name: The name of the order item. Required. + :type order_item_name: str + :param return_order_item_details: Return order item details. Is one of the following types: + ReturnOrderItemDetails, JSON, IO[bytes] Required. + :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OkResponse. The OkResponse is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OkResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) + cls: ClsType[_models.OkResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_order_item_initial( - order_item_name=order_item_name, + raw_result = self._return_order_item_initial( resource_group_name=resource_group_name, - order_item_resource=order_item_resource, - api_version=api_version, + order_item_name=order_item_name, + return_order_item_details=return_order_item_details, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -2669,32 +3057,73 @@ def begin_create_order_item( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OkResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.OrderItemResource].from_continuation_token( + return LROPoller[_models.OkResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OrderItemResource]( + return LROPoller[_models.OkResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_order_item_by_name_initial( - self, order_item_name: str, resource_group_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + +class OrderResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`order_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, location: str, order_name: str, **kwargs: Any) -> _models.OrderResource: + """Get an order. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param order_name: The name of the order. Required. + :type order_name: str + :return: OrderResource. The OrderResource is compatible with MutableMapping + :rtype: ~azure.mgmt.edgeorder.models.OrderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2703,386 +3132,468 @@ def _delete_order_item_by_name_initial( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.OrderResource] = kwargs.pop("cls", None) - _request = build_delete_order_item_by_name_request( - order_item_name=order_item_name, + _request = build_order_resources_get_request( resource_group_name=resource_group_name, + location=location, + order_name=order_name, subscription_id=self._config.subscription_id, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OrderResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_delete_order_item_by_name( - self, order_item_name: str, resource_group_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an order item. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] +class ProductsAndConfigurationsOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`products_and_configurations_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list_configurations( + self, + configurations_request: _models.ConfigurationsRequest, + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_order_item_by_name_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + @overload + def list_configurations( + self, + configurations_request: JSON, + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: JSON + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @overload + def list_configurations( + self, + configurations_request: IO[bytes], + *, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Required. + :type configurations_request: IO[bytes] + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def _update_order_item_initial( + @distributed_trace + def list_configurations( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: Union[_models.OrderItemUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, + configurations_request: Union[_models.ConfigurationsRequest, JSON, IO[bytes]], + *, + skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterable["_models.Configuration"]: + """List configurations for the given product family, product line and product for the given + subscription. + + :param configurations_request: Filters for showing the configurations. Is one of the following + types: ConfigurationsRequest, JSON, IO[bytes] Required. + :type configurations_request: ~azure.mgmt.edgeorder.models.ConfigurationsRequest or JSON or + IO[bytes] + :keyword skip_token: $skipToken is supported on list of configurations, which provides the next + page in the list of configurations. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of Configuration + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.Configuration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.Configuration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None _content = None - if isinstance(order_item_update_parameter, (IOBase, bytes)): - _content = order_item_update_parameter + if isinstance(configurations_request, (IOBase, bytes)): + _content = configurations_request else: - _json = self._serialize.body(order_item_update_parameter, "OrderItemUpdateParameter") + _content = json.dumps(configurations_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_update_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def prepare_request(next_link=None): + if not next_link: - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _request = build_products_and_configurations_operation_group_list_configurations_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return _request - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Configuration], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def list_product_families( + self, + product_families_request: _models.ProductFamiliesRequest, + *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.ProductFamily"]: + """List product families for the given subscription. - return deserialized # type: ignore + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] + :raises ~azure.core.exceptions.HttpResponseError: + """ @overload - def begin_update_order_item( + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: _models.OrderItemUpdateParameter, - if_match: Optional[str] = None, + product_families_request: JSON, *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> Iterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Required. - :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: JSON + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_order_item( + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: IO[bytes], - if_match: Optional[str] = None, + product_families_request: IO[bytes], *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> Iterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Required. - :type order_item_update_parameter: IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str + :param product_families_request: Filters for showing the product families. Required. + :type product_families_request: IO[bytes] + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_order_item( + def list_product_families( self, - order_item_name: str, - resource_group_name: str, - order_item_update_parameter: Union[_models.OrderItemUpdateParameter, IO[bytes]], - if_match: Optional[str] = None, + product_families_request: Union[_models.ProductFamiliesRequest, JSON, IO[bytes]], + *, + expand: Optional[str] = None, + skip_token: Optional[str] = None, **kwargs: Any - ) -> LROPoller[_models.OrderItemResource]: - """Updates the properties of an existing order item. + ) -> Iterable["_models.ProductFamily"]: + """List product families for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param order_item_update_parameter: order item update parameters from request body. Is either a - OrderItemUpdateParameter type or a IO[bytes] type. Required. - :type order_item_update_parameter: ~azure.mgmt.edgeorder.models.OrderItemUpdateParameter or + :param product_families_request: Filters for showing the product families. Is one of the + following types: ProductFamiliesRequest, JSON, IO[bytes] Required. + :type product_families_request: ~azure.mgmt.edgeorder.models.ProductFamiliesRequest or JSON or IO[bytes] - :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag - of the order on the server matches this value. Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either OrderItemResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.edgeorder.models.OrderItemResource] + :keyword expand: $expand is supported on configurations parameter for product, which provides + details on the configurations for the product. Default value is None. + :paramtype expand: str + :keyword skip_token: $skipToken is supported on list of product families, which provides the + next page in the list of product families. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProductFamily + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamily] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OrderItemResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_order_item_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - order_item_update_parameter=order_item_update_parameter, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.ProductFamily]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OrderItemResource", pipeline_response.http_response) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(product_families_request, (IOBase, bytes)): + _content = product_families_request + else: + _content = json.dumps(product_families_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_and_configurations_operation_group_list_product_families_request( + subscription_id=self._config.subscription_id, + expand=expand, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProductFamily], deserialized.get("value", [])) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OrderItemResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OrderItemResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + def get_next(next_link=None): + _request = prepare_request(next_link) - @overload - def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: _models.CancellationReason, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Cancel order item. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Required. - :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @overload - def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Cancel order item. + return pipeline_response - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Required. - :type cancellation_reason: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + return ItemPaged(get_next, extract_data) @distributed_trace - def cancel_order_item( # pylint: disable=inconsistent-return-statements - self, - order_item_name: str, - resource_group_name: str, - cancellation_reason: Union[_models.CancellationReason, IO[bytes]], - **kwargs: Any - ) -> None: - """Cancel order item. + def list_product_families_metadata( + self, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ProductFamiliesMetadataDetails"]: + """List product families metadata for the given subscription. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a - IO[bytes] type. Required. - :type cancellation_reason: ~azure.mgmt.edgeorder.models.CancellationReason or IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :keyword skip_token: $skipToken is supported on list of product families metadata, which + provides the next page in the list of product families metadata. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ProductFamiliesMetadataDetails + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.ProductFamiliesMetadataDetails] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProductFamiliesMetadataDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3090,57 +3601,110 @@ def cancel_order_item( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_and_configurations_operation_group_list_product_families_metadata_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ProductFamiliesMetadataDetails], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + return pipeline_response - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cancellation_reason, (IOBase, bytes)): - _content = cancellation_reason - else: - _json = self._serialize.body(cancellation_reason, "CancellationReason") + return ItemPaged(get_next, extract_data) - _request = build_cancel_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) +class OrdersOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - response = pipeline_response.http_response + Instead, you should access the following operations through + :class:`~azure.mgmt.edgeorder.EdgeOrderClient`'s + :attr:`orders_operation_group` attribute. + """ - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: EdgeOrderClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - if cls: - return cls(pipeline_response, None, {}) # type: ignore + @distributed_trace + def list_by_subscription( + self, *, skip_token: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.OrderResource"]: + """List orders at subscription level. + + :keyword skip_token: $skipToken is supported on Get list of orders, which provides the next + page in the list of orders. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def _return_order_item_initial( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: Union[_models.ReturnOrderItemDetails, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + cls: ClsType[List[_models.OrderResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3148,174 +3712,165 @@ def _return_order_item_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_orders_operation_group_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(return_order_item_details, (IOBase, bytes)): - _content = return_order_item_details - else: - _json = self._serialize.body(return_order_item_details, "ReturnOrderItemDetails") + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_return_order_item_request( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) - @overload - def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: _models.ReturnOrderItemDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Return order item. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, skip_token: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.OrderResource"]: + """List orders at resource group level. - :param order_item_name: The name of the order item. Required. - :type order_item_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Required. - :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :keyword skip_token: $skipToken is supported on Get list of orders, which provides the next + page in the list of orders. Default value is None. + :paramtype skip_token: str + :keyword top: $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. Default value is None. + :paramtype top: int + :return: An iterator like instance of OrderResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.edgeorder.models.OrderResource] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Return order item. + cls: ClsType[List[_models.OrderResource]] = kwargs.pop("cls", None) - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Required. - :type return_order_item_details: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def begin_return_order_item( - self, - order_item_name: str, - resource_group_name: str, - return_order_item_details: Union[_models.ReturnOrderItemDetails, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Return order item. + def prepare_request(next_link=None): + if not next_link: - :param order_item_name: The name of the order item. Required. - :type order_item_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param return_order_item_details: Return order item CurrentStatus. Is either a - ReturnOrderItemDetails type or a IO[bytes] type. Required. - :type return_order_item_details: ~azure.mgmt.edgeorder.models.ReturnOrderItemDetails or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _request = build_orders_operation_group_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._return_order_item_initial( - order_item_name=order_item_name, - resource_group_name=resource_group_name, - return_order_item_details=return_order_item_details, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OrderResource], deserialized.get("value", [])) if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_patch.py b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_patch.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/azure/mgmt/edgeorder/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py index a4750c91be8d..e457f8027321 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/cancel_order_item.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - client.cancel_order_item( - order_item_name="TestOrderItemName3", + client.order_item_resources.cancel( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderItemName3", cancellation_reason={"reason": "Order cancelled"}, ) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CancelOrderItem.json +# x-ms-original-file: 2024-02-01/CancelOrderItem.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_address.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_address.py index 49ccd2aac278..ce73f7bcd31b 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_address.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_address.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,17 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.begin_create_address( - address_name="TestAddressName2", + client.address_resources.begin_create( resource_group_name="YourResourceGroupName", + address_name="TestAddressName2", address_resource={ "location": "eastus", "properties": { + "addressClassification": "Shipping", "contactDetails": { "contactName": "XXXX XXXX", "emailList": ["xxxx@xxxx.xxx"], @@ -55,9 +56,8 @@ def main(): }, }, ).result() - print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CreateAddress.json +# x-ms-original-file: 2024-02-01/CreateAddress.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_order_item.py index db06228292e5..22303fe0b00c 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/create_order_item.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,14 +26,14 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.begin_create_order_item( - order_item_name="TestOrderItemName2", + client.order_item_resources.begin_create( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderItemName2", order_item_resource={ "location": "eastus", "properties": { @@ -56,7 +57,7 @@ def main(): }, } }, - "orderId": "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2", + "orderId": "/subscriptions/eb5dc900-6186-49d8-b7d7-febd866fdc1d/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2", "orderItemDetails": { "orderItemType": "Purchase", "preferences": {"transportPreferences": {"preferredShipmentType": "MicrosoftManaged"}}, @@ -72,9 +73,8 @@ def main(): }, }, ).result() - print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/CreateOrderItem.json +# x-ms-original-file: 2024-02-01/CreateOrderItem.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py index b46f5823b729..ce39b6322e25 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_address_by_name.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,17 +25,17 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - client.begin_delete_address_by_name( - address_name="TestAddressName1", + client.address_resources.begin_delete( resource_group_name="YourResourceGroupName", + address_name="TestAddressName1", ).result() -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteAddressByName.json +# x-ms-original-file: 2024-02-01/DeleteAddressByName.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py index e58f9397efb7..1bfd3a9f2106 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/delete_order_item_by_name.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,17 +25,17 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - client.begin_delete_order_item_by_name( - order_item_name="TestOrderItemName3", + client.order_item_resources.begin_delete( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderItemName3", ).result() -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/DeleteOrderItemByName.json +# x-ms-original-file: 2024-02-01/DeleteOrderItemByName.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_address_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_address_by_name.py index b840f49ed598..99a28b03ebfd 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_address_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_address_by_name.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.get_address_by_name( - address_name="TestAddressName1", + response = client.address_resources.get( resource_group_name="YourResourceGroupName", + address_name="TestAddressName1", ) print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetAddressByName.json +# x-ms-original-file: 2024-02-01/GetAddressByName.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_by_name.py index a90f586ec7cf..addfd3b7422a 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_by_name.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,19 +25,19 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.get_order_by_name( - order_name="TestOrderName3", + response = client.order_resources.get( resource_group_name="YourResourceGroupName", location="eastus", + order_name="TestOrderName3", ) print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderByName.json +# x-ms-original-file: 2024-02-01/GetOrderByName.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_item_by_name.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_item_by_name.py index 4e40069d6b83..077725fea4a0 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_item_by_name.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/get_order_item_by_name.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.get_order_item_by_name( - order_item_name="TestOrderItemName1", + response = client.order_item_resources.get( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderItemName1", ) print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/GetOrderItemByName.json +# x-ms-original-file: 2024-02-01/GetOrderItemByName.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_resource_group_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_resource_group_level.py index 836564b56ac6..038b51073c29 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_resource_group_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_resource_group_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_addresses_at_resource_group_level( + response = client.address_resources.list_by_resource_group( resource_group_name="YourResourceGroupName", ) for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListAddressesAtResourceGroupLevel.json +# x-ms-original-file: 2024-02-01/ListAddressesAtResourceGroupLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_subscription_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_subscription_level.py index b92994338c93..4862b48e66d7 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_subscription_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_addresses_at_subscription_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,16 +25,16 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_addresses_at_subscription_level() + response = client.address_resources.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListAddressesAtSubscriptionLevel.json +# x-ms-original-file: 2024-02-01/ListAddressesAtSubscriptionLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_configurations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_configurations.py index b3b33363334f..42483268d4a4 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_configurations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_configurations.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,29 +25,27 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_configurations( + response = client.products_and_configurations_operation_group.list_configurations( configurations_request={ - "configurationFilters": [ - { - "filterableProperty": [{"supportedValues": ["US"], "type": "ShipToCountries"}], - "hierarchyInformation": { - "productFamilyName": "azurestackedge", - "productLineName": "azurestackedge", - "productName": "azurestackedgegpu", - }, - } - ] + "configurationFilter": { + "filterableProperty": [{"supportedValues": ["US"], "type": "ShipToCountries"}], + "hierarchyInformation": { + "productFamilyName": "azurestackedge", + "productLineName": "azurestackedge", + "productName": "azurestackedgegpu", + }, + } }, ) for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListConfigurations.json +# x-ms-original-file: 2024-02-01/ListConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_operations.py index 1cb12208f727..6a196e2add18 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_operations.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_operations.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,16 +25,16 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) - response = client.list_operations() + response = client.operations.list() for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOperations.json +# x-ms-original-file: 2024-02-01/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_resource_group_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_resource_group_level.py index e4a5b595cd89..0f300e1bba6c 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_resource_group_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_resource_group_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_order_at_resource_group_level( + response = client.orders_operation_group.list_by_resource_group( resource_group_name="YourResourceGroupName", ) for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtResourceGroupLevel.json +# x-ms-original-file: 2024-02-01/ListOrderAtResourceGroupLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_subscription_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_subscription_level.py index ba5a88c171e8..6f043038bf17 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_subscription_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_at_subscription_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,16 +25,16 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_order_at_subscription_level() + response = client.orders_operation_group.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderAtSubscriptionLevel.json +# x-ms-original-file: 2024-02-01/ListOrderAtSubscriptionLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_resource_group_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_resource_group_level.py index a8b07983bfd1..49b6f9be0e09 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_resource_group_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_resource_group_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,18 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_order_items_at_resource_group_level( + response = client.order_item_resources.list_by_resource_group( resource_group_name="YourResourceGroupName", ) for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderItemsAtResourceGroupLevel.json +# x-ms-original-file: 2024-02-01/ListOrderItemsAtResourceGroupLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_subscription_level.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_subscription_level.py index 63aa57d2d7a7..967f8e92288c 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_subscription_level.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_order_items_at_subscription_level.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,16 +25,16 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_order_items_at_subscription_level() + response = client.order_item_resources.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListOrderItemsAtSubscriptionLevel.json +# x-ms-original-file: 2024-02-01/ListOrderItemsAtSubscriptionLevel.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families.py index f50795ca837e..258f1ee58687 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,12 +25,12 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_product_families( + response = client.products_and_configurations_operation_group.list_product_families( product_families_request={ "filterableProperties": {"azurestackedge": [{"supportedValues": ["US"], "type": "ShipToCountries"}]} }, @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamilies.json +# x-ms-original-file: 2024-02-01/ListProductFamilies.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families_metadata.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families_metadata.py index 819b90d502cd..fdcd66d42795 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families_metadata.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/list_product_families_metadata.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,16 +25,16 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.list_product_families_metadata() + response = client.products_and_configurations_operation_group.list_product_families_metadata() for item in response: print(item) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ListProductFamiliesMetadata.json +# x-ms-original-file: 2024-02-01/ListProductFamiliesMetadata.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py index 04ec971ac22c..ac42dd1c7561 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/return_order_item.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,18 +25,19 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - client.begin_return_order_item( - order_item_name="TestOrderName4", + response = client.order_item_resources.begin_return_order_item( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderName4", return_order_item_details={"returnReason": "Order returned"}, ).result() + print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/ReturnOrderItem.json +# x-ms-original-file: 2024-02-01/ReturnOrderItem.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_address.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_address.py index 5b062f78f288..50ec14bde5b1 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_address.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_address.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,14 +25,14 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.begin_update_address( - address_name="TestAddressName2", + response = client.address_resources.begin_update( resource_group_name="YourResourceGroupName", + address_name="TestAddressName2", address_update_parameter={ "properties": { "contactDetails": { @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/UpdateAddress.json +# x-ms-original-file: 2024-02-01/UpdateAddress.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_order_item.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_order_item.py index 06492c46b840..25839dcc44df 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_order_item.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_samples/update_order_item.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.edgeorder import EdgeOrderManagementClient +from azure.mgmt.edgeorder import EdgeOrderClient """ # PREREQUISITES @@ -25,14 +25,14 @@ def main(): - client = EdgeOrderManagementClient( + client = EdgeOrderClient( credential=DefaultAzureCredential(), - subscription_id="YourSubscriptionId", + subscription_id="SUBSCRIPTION_ID", ) - response = client.begin_update_order_item( - order_item_name="TestOrderItemName3", + response = client.order_item_resources.begin_update( resource_group_name="YourResourceGroupName", + order_item_name="TestOrderItemName3", order_item_update_parameter={ "properties": {"preferences": {"transportPreferences": {"preferredShipmentType": "CustomerManaged"}}} }, @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/edgeorder/resource-manager/Microsoft.EdgeOrder/stable/2021-12-01/examples/UpdateOrderItem.json +# x-ms-original-file: 2024-02-01/UpdateOrderItem.json if __name__ == "__main__": main() diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/conftest.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/conftest.py index 6437dcff6284..d5288024dba5 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/conftest.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os @@ -18,19 +18,17 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - edgeordermanagement_subscription_id = os.environ.get( - "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - edgeordermanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - edgeordermanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - edgeordermanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=edgeordermanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=edgeordermanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=edgeordermanagement_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=edgeordermanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + edgeorder_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + edgeorder_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + edgeorder_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + edgeorder_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=edgeorder_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=edgeorder_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=edgeorder_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=edgeorder_client_secret, value="00000000-0000-0000-0000-000000000000") add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations.py new file mode 100644 index 000000000000..512b5a5fdd88 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderAddressResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_get(self, resource_group): + response = self.client.address_resources.get( + resource_group_name=resource_group.name, + address_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_begin_create(self, resource_group): + response = self.client.address_resources.begin_create( + resource_group_name=resource_group.name, + address_name="str", + address_resource={ + "location": "str", + "properties": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_begin_update(self, resource_group): + response = self.client.address_resources.begin_update( + resource_group_name=resource_group.name, + address_name="str", + address_update_parameter={ + "properties": { + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "tags": {"str": "str"}, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_begin_delete(self, resource_group): + response = self.client.address_resources.begin_delete( + resource_group_name=resource_group.name, + address_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_list_by_resource_group(self, resource_group): + response = self.client.address_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_address_resources_list_by_subscription(self, resource_group): + response = self.client.address_resources.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations_async.py new file mode 100644 index 000000000000..62a2ce183d59 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_address_resources_operations_async.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderAddressResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_get(self, resource_group): + response = await self.client.address_resources.get( + resource_group_name=resource_group.name, + address_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_begin_create(self, resource_group): + response = await ( + await self.client.address_resources.begin_create( + resource_group_name=resource_group.name, + address_name="str", + address_resource={ + "location": "str", + "properties": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_begin_update(self, resource_group): + response = await ( + await self.client.address_resources.begin_update( + resource_group_name=resource_group.name, + address_name="str", + address_update_parameter={ + "properties": { + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_begin_delete(self, resource_group): + response = await ( + await self.client.address_resources.begin_delete( + resource_group_name=resource_group.name, + address_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_list_by_resource_group(self, resource_group): + response = self.client.address_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_address_resources_list_by_subscription(self, resource_group): + response = self.client.address_resources.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management.py deleted file mode 100644 index 8749498417a5..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management.py +++ /dev/null @@ -1,526 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.edgeorder import EdgeOrderManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEdgeOrderManagement(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(EdgeOrderManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_operations(self, resource_group): - response = self.client.list_operations( - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_addresses_at_subscription_level(self, resource_group): - response = self.client.list_addresses_at_subscription_level( - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_product_families(self, resource_group): - response = self.client.list_product_families( - product_families_request={ - "filterableProperties": {"str": [{"supportedValues": ["str"], "type": "str"}]}, - "customerSubscriptionDetails": { - "quotaId": "str", - "locationPlacementId": "str", - "registeredFeatures": [{"name": "str", "state": "str"}], - }, - }, - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_configurations(self, resource_group): - response = self.client.list_configurations( - configurations_request={ - "configurationFilters": [ - { - "hierarchyInformation": { - "configurationName": "str", - "productFamilyName": "str", - "productLineName": "str", - "productName": "str", - }, - "filterableProperty": [{"supportedValues": ["str"], "type": "str"}], - } - ], - "customerSubscriptionDetails": { - "quotaId": "str", - "locationPlacementId": "str", - "registeredFeatures": [{"name": "str", "state": "str"}], - }, - }, - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_product_families_metadata(self, resource_group): - response = self.client.list_product_families_metadata( - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_order_at_subscription_level(self, resource_group): - response = self.client.list_order_at_subscription_level( - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_order_items_at_subscription_level(self, resource_group): - response = self.client.list_order_items_at_subscription_level( - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_addresses_at_resource_group_level(self, resource_group): - response = self.client.list_addresses_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_get_address_by_name(self, resource_group): - response = self.client.get_address_by_name( - address_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_create_address(self, resource_group): - response = self.client.begin_create_address( - address_name="str", - resource_group_name=resource_group.name, - address_resource={ - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "location": "str", - "addressValidationStatus": "str", - "id": "str", - "name": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_delete_address_by_name(self, resource_group): - response = self.client.begin_delete_address_by_name( - address_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_update_address(self, resource_group): - response = self.client.begin_update_address( - address_name="str", - resource_group_name=resource_group.name, - address_update_parameter={ - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - "tags": {"str": "str"}, - }, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_order_at_resource_group_level(self, resource_group): - response = self.client.list_order_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_get_order_by_name(self, resource_group): - response = self.client.get_order_by_name( - order_name="str", - resource_group_name=resource_group.name, - location="str", - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_order_items_at_resource_group_level(self, resource_group): - response = self.client.list_order_items_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_get_order_item_by_name(self, resource_group): - response = self.client.get_order_item_by_name( - order_item_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_create_order_item(self, resource_group): - response = self.client.begin_create_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - order_item_resource={ - "addressDetails": { - "forwardAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "returnAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - }, - "location": "str", - "orderId": "str", - "orderItemDetails": { - "orderItemType": "str", - "productDetails": { - "hierarchyInformation": { - "configurationName": "str", - "productFamilyName": "str", - "productLineName": "str", - "productName": "str", - }, - "count": 0, - "deviceDetails": [ - {"managementResourceId": "str", "managementResourceTenantId": "str", "serialNumber": "str"} - ], - "displayInfo": {"configurationDisplayName": "str", "productFamilyDisplayName": "str"}, - "productDoubleEncryptionStatus": "str", - }, - "cancellationReason": "str", - "cancellationStatus": "str", - "currentStage": { - "displayName": "str", - "stageName": "str", - "stageStatus": "str", - "startTime": "2020-02-20 00:00:00", - }, - "deletionStatus": "str", - "error": { - "additionalInfo": [{"info": {}, "type": "str"}], - "code": "str", - "details": [...], - "message": "str", - "target": "str", - }, - "forwardShippingDetails": { - "carrierDisplayName": "str", - "carrierName": "str", - "trackingId": "str", - "trackingUrl": "str", - }, - "managementRpDetails": {"resourceProviderNamespace": "str"}, - "managementRpDetailsList": [{"resourceProviderNamespace": "str"}], - "notificationEmailList": ["str"], - "orderItemStageHistory": [ - { - "displayName": "str", - "stageName": "str", - "stageStatus": "str", - "startTime": "2020-02-20 00:00:00", - } - ], - "preferences": { - "encryptionPreferences": {"doubleEncryptionStatus": "str"}, - "managementResourcePreferences": {"preferredManagementResourceId": "str"}, - "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], - "transportPreferences": {"preferredShipmentType": "str"}, - }, - "returnReason": "str", - "returnStatus": "str", - "reverseShippingDetails": { - "carrierDisplayName": "str", - "carrierName": "str", - "sasKeyForLabel": "str", - "trackingId": "str", - "trackingUrl": "str", - }, - }, - "id": "str", - "name": "str", - "startTime": "2020-02-20 00:00:00", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_delete_order_item_by_name(self, resource_group): - response = self.client.begin_delete_order_item_by_name( - order_item_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_update_order_item(self, resource_group): - response = self.client.begin_update_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - order_item_update_parameter={ - "forwardAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "notificationEmailList": ["str"], - "preferences": { - "encryptionPreferences": {"doubleEncryptionStatus": "str"}, - "managementResourcePreferences": {"preferredManagementResourceId": "str"}, - "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], - "transportPreferences": {"preferredShipmentType": "str"}, - }, - "tags": {"str": "str"}, - }, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cancel_order_item(self, resource_group): - response = self.client.cancel_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - cancellation_reason={"reason": "str"}, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_return_order_item(self, resource_group): - response = self.client.begin_return_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - return_order_item_details={ - "returnReason": "str", - "returnAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "serviceTag": "str", - "shippingBoxRequired": False, - }, - api_version="2021-12-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management_async.py deleted file mode 100644 index 480370133205..000000000000 --- a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_management_async.py +++ /dev/null @@ -1,545 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.edgeorder.aio import EdgeOrderManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEdgeOrderManagementAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(EdgeOrderManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_operations(self, resource_group): - response = self.client.list_operations( - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_addresses_at_subscription_level(self, resource_group): - response = self.client.list_addresses_at_subscription_level( - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_product_families(self, resource_group): - response = self.client.list_product_families( - product_families_request={ - "filterableProperties": {"str": [{"supportedValues": ["str"], "type": "str"}]}, - "customerSubscriptionDetails": { - "quotaId": "str", - "locationPlacementId": "str", - "registeredFeatures": [{"name": "str", "state": "str"}], - }, - }, - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_configurations(self, resource_group): - response = self.client.list_configurations( - configurations_request={ - "configurationFilters": [ - { - "hierarchyInformation": { - "configurationName": "str", - "productFamilyName": "str", - "productLineName": "str", - "productName": "str", - }, - "filterableProperty": [{"supportedValues": ["str"], "type": "str"}], - } - ], - "customerSubscriptionDetails": { - "quotaId": "str", - "locationPlacementId": "str", - "registeredFeatures": [{"name": "str", "state": "str"}], - }, - }, - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_product_families_metadata(self, resource_group): - response = self.client.list_product_families_metadata( - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_order_at_subscription_level(self, resource_group): - response = self.client.list_order_at_subscription_level( - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_order_items_at_subscription_level(self, resource_group): - response = self.client.list_order_items_at_subscription_level( - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_addresses_at_resource_group_level(self, resource_group): - response = self.client.list_addresses_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_get_address_by_name(self, resource_group): - response = await self.client.get_address_by_name( - address_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_create_address(self, resource_group): - response = await ( - await self.client.begin_create_address( - address_name="str", - resource_group_name=resource_group.name, - address_resource={ - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "location": "str", - "addressValidationStatus": "str", - "id": "str", - "name": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_delete_address_by_name(self, resource_group): - response = await ( - await self.client.begin_delete_address_by_name( - address_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_update_address(self, resource_group): - response = await ( - await self.client.begin_update_address( - address_name="str", - resource_group_name=resource_group.name, - address_update_parameter={ - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - "tags": {"str": "str"}, - }, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_order_at_resource_group_level(self, resource_group): - response = self.client.list_order_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_get_order_by_name(self, resource_group): - response = await self.client.get_order_by_name( - order_name="str", - resource_group_name=resource_group.name, - location="str", - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_order_items_at_resource_group_level(self, resource_group): - response = self.client.list_order_items_at_resource_group_level( - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_get_order_item_by_name(self, resource_group): - response = await self.client.get_order_item_by_name( - order_item_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_create_order_item(self, resource_group): - response = await ( - await self.client.begin_create_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - order_item_resource={ - "addressDetails": { - "forwardAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "returnAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - }, - "location": "str", - "orderId": "str", - "orderItemDetails": { - "orderItemType": "str", - "productDetails": { - "hierarchyInformation": { - "configurationName": "str", - "productFamilyName": "str", - "productLineName": "str", - "productName": "str", - }, - "count": 0, - "deviceDetails": [ - { - "managementResourceId": "str", - "managementResourceTenantId": "str", - "serialNumber": "str", - } - ], - "displayInfo": {"configurationDisplayName": "str", "productFamilyDisplayName": "str"}, - "productDoubleEncryptionStatus": "str", - }, - "cancellationReason": "str", - "cancellationStatus": "str", - "currentStage": { - "displayName": "str", - "stageName": "str", - "stageStatus": "str", - "startTime": "2020-02-20 00:00:00", - }, - "deletionStatus": "str", - "error": { - "additionalInfo": [{"info": {}, "type": "str"}], - "code": "str", - "details": [...], - "message": "str", - "target": "str", - }, - "forwardShippingDetails": { - "carrierDisplayName": "str", - "carrierName": "str", - "trackingId": "str", - "trackingUrl": "str", - }, - "managementRpDetails": {"resourceProviderNamespace": "str"}, - "managementRpDetailsList": [{"resourceProviderNamespace": "str"}], - "notificationEmailList": ["str"], - "orderItemStageHistory": [ - { - "displayName": "str", - "stageName": "str", - "stageStatus": "str", - "startTime": "2020-02-20 00:00:00", - } - ], - "preferences": { - "encryptionPreferences": {"doubleEncryptionStatus": "str"}, - "managementResourcePreferences": {"preferredManagementResourceId": "str"}, - "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], - "transportPreferences": {"preferredShipmentType": "str"}, - }, - "returnReason": "str", - "returnStatus": "str", - "reverseShippingDetails": { - "carrierDisplayName": "str", - "carrierName": "str", - "sasKeyForLabel": "str", - "trackingId": "str", - "trackingUrl": "str", - }, - }, - "id": "str", - "name": "str", - "startTime": "2020-02-20 00:00:00", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_delete_order_item_by_name(self, resource_group): - response = await ( - await self.client.begin_delete_order_item_by_name( - order_item_name="str", - resource_group_name=resource_group.name, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_update_order_item(self, resource_group): - response = await ( - await self.client.begin_update_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - order_item_update_parameter={ - "forwardAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "notificationEmailList": ["str"], - "preferences": { - "encryptionPreferences": {"doubleEncryptionStatus": "str"}, - "managementResourcePreferences": {"preferredManagementResourceId": "str"}, - "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], - "transportPreferences": {"preferredShipmentType": "str"}, - }, - "tags": {"str": "str"}, - }, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cancel_order_item(self, resource_group): - response = await self.client.cancel_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - cancellation_reason={"reason": "str"}, - api_version="2021-12-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_return_order_item(self, resource_group): - response = await ( - await self.client.begin_return_order_item( - order_item_name="str", - resource_group_name=resource_group.name, - return_order_item_details={ - "returnReason": "str", - "returnAddress": { - "contactDetails": { - "contactName": "str", - "emailList": ["str"], - "phone": "str", - "mobile": "str", - "phoneExtension": "str", - }, - "addressValidationStatus": "str", - "shippingAddress": { - "country": "str", - "streetAddress1": "str", - "addressType": "str", - "city": "str", - "companyName": "str", - "postalCode": "str", - "stateOrProvince": "str", - "streetAddress2": "str", - "streetAddress3": "str", - "zipExtendedCode": "str", - }, - }, - "serviceTag": "str", - "shippingBoxRequired": False, - }, - api_version="2021-12-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations.py new file mode 100644 index 000000000000..2ef1a117fc7a --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations_async.py new file mode 100644 index 000000000000..3913ead8cd02 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_operations_async.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations.py new file mode 100644 index 000000000000..250397ac5282 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations.py @@ -0,0 +1,445 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrderItemResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_get(self, resource_group): + response = self.client.order_item_resources.get( + resource_group_name=resource_group.name, + order_item_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_begin_create(self, resource_group): + response = self.client.order_item_resources.begin_create( + resource_group_name=resource_group.name, + order_item_name="str", + order_item_resource={ + "location": "str", + "properties": { + "orderId": "str", + "orderItemDetails": { + "orderItemType": "str", + "productDetails": { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "childConfigurationDeviceDetails": [ + { + "deviceDetails": [ + { + "displaySerialNumber": "str", + "managementResourceId": "str", + "managementResourceTenantId": "str", + "provisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "provisioningSupport": "str", + "serialNumber": "str", + } + ], + "displayInfo": { + "configurationDisplayName": "str", + "productFamilyDisplayName": "str", + }, + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "identificationType": "str", + "quantity": 0, + "termCommitmentInformation": { + "termCommitmentType": "str", + "pendingDaysForTerm": 0, + "termCommitmentTypeDuration": "1 day, 0:00:00", + }, + } + ], + "displayInfo": {"configurationDisplayName": "str", "productFamilyDisplayName": "str"}, + "identificationType": "str", + "optInAdditionalConfigurations": [ + { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "quantity": 0, + "provisioningDetails": [ + { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + } + ], + } + ], + "parentDeviceDetails": { + "displaySerialNumber": "str", + "managementResourceId": "str", + "managementResourceTenantId": "str", + "provisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "provisioningSupport": "str", + "serialNumber": "str", + }, + "parentProvisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "productDoubleEncryptionStatus": "str", + "termCommitmentInformation": { + "termCommitmentType": "str", + "pendingDaysForTerm": 0, + "termCommitmentTypeDuration": "1 day, 0:00:00", + }, + }, + "cancellationReason": "str", + "cancellationStatus": "str", + "currentStage": { + "displayName": "str", + "stageName": "str", + "stageStatus": "str", + "startTime": "2020-02-20 00:00:00", + }, + "deletionStatus": "str", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "forwardShippingDetails": { + "carrierDisplayName": "str", + "carrierName": "str", + "trackingId": "str", + "trackingUrl": "str", + }, + "managementRpDetailsList": [{"resourceProviderNamespace": "str"}], + "notificationEmailList": ["str"], + "orderItemMode": "str", + "orderItemStageHistory": [ + { + "displayName": "str", + "stageName": "str", + "stageStatus": "str", + "startTime": "2020-02-20 00:00:00", + } + ], + "preferences": { + "encryptionPreferences": {"doubleEncryptionStatus": "str"}, + "managementResourcePreferences": {"preferredManagementResourceId": "str"}, + "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], + "termCommitmentPreferences": { + "preferredTermCommitmentType": "str", + "preferredTermCommitmentDuration": "1 day, 0:00:00", + }, + "transportPreferences": {"preferredShipmentType": "str"}, + }, + "returnReason": "str", + "returnStatus": "str", + "reverseShippingDetails": { + "carrierDisplayName": "str", + "carrierName": "str", + "sasKeyForLabel": "str", + "trackingId": "str", + "trackingUrl": "str", + }, + "siteDetails": {"siteId": "str"}, + }, + "addressDetails": { + "forwardAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "returnAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + }, + "provisioningState": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_begin_update(self, resource_group): + response = self.client.order_item_resources.begin_update( + resource_group_name=resource_group.name, + order_item_name="str", + order_item_update_parameter={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "forwardAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "notificationEmailList": ["str"], + "orderItemDetails": { + "productDetails": { + "parentProvisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + } + }, + "siteDetails": {"siteId": "str"}, + }, + "preferences": { + "encryptionPreferences": {"doubleEncryptionStatus": "str"}, + "managementResourcePreferences": {"preferredManagementResourceId": "str"}, + "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], + "termCommitmentPreferences": { + "preferredTermCommitmentType": "str", + "preferredTermCommitmentDuration": "1 day, 0:00:00", + }, + "transportPreferences": {"preferredShipmentType": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_begin_delete(self, resource_group): + response = self.client.order_item_resources.begin_delete( + resource_group_name=resource_group.name, + order_item_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_list_by_resource_group(self, resource_group): + response = self.client.order_item_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_list_by_subscription(self, resource_group): + response = self.client.order_item_resources.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_cancel(self, resource_group): + response = self.client.order_item_resources.cancel( + resource_group_name=resource_group.name, + order_item_name="str", + cancellation_reason={"reason": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_item_resources_begin_return_order_item(self, resource_group): + response = self.client.order_item_resources.begin_return_order_item( + resource_group_name=resource_group.name, + order_item_name="str", + return_order_item_details={ + "returnReason": "str", + "returnAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "serviceTag": "str", + "shippingBoxRequired": bool, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations_async.py new file mode 100644 index 000000000000..6d1ec0940026 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_item_resources_operations_async.py @@ -0,0 +1,454 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrderItemResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_get(self, resource_group): + response = await self.client.order_item_resources.get( + resource_group_name=resource_group.name, + order_item_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_begin_create(self, resource_group): + response = await ( + await self.client.order_item_resources.begin_create( + resource_group_name=resource_group.name, + order_item_name="str", + order_item_resource={ + "location": "str", + "properties": { + "orderId": "str", + "orderItemDetails": { + "orderItemType": "str", + "productDetails": { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "childConfigurationDeviceDetails": [ + { + "deviceDetails": [ + { + "displaySerialNumber": "str", + "managementResourceId": "str", + "managementResourceTenantId": "str", + "provisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "provisioningSupport": "str", + "serialNumber": "str", + } + ], + "displayInfo": { + "configurationDisplayName": "str", + "productFamilyDisplayName": "str", + }, + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "identificationType": "str", + "quantity": 0, + "termCommitmentInformation": { + "termCommitmentType": "str", + "pendingDaysForTerm": 0, + "termCommitmentTypeDuration": "1 day, 0:00:00", + }, + } + ], + "displayInfo": {"configurationDisplayName": "str", "productFamilyDisplayName": "str"}, + "identificationType": "str", + "optInAdditionalConfigurations": [ + { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "quantity": 0, + "provisioningDetails": [ + { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + } + ], + } + ], + "parentDeviceDetails": { + "displaySerialNumber": "str", + "managementResourceId": "str", + "managementResourceTenantId": "str", + "provisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "provisioningSupport": "str", + "serialNumber": "str", + }, + "parentProvisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + }, + "productDoubleEncryptionStatus": "str", + "termCommitmentInformation": { + "termCommitmentType": "str", + "pendingDaysForTerm": 0, + "termCommitmentTypeDuration": "1 day, 0:00:00", + }, + }, + "cancellationReason": "str", + "cancellationStatus": "str", + "currentStage": { + "displayName": "str", + "stageName": "str", + "stageStatus": "str", + "startTime": "2020-02-20 00:00:00", + }, + "deletionStatus": "str", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "forwardShippingDetails": { + "carrierDisplayName": "str", + "carrierName": "str", + "trackingId": "str", + "trackingUrl": "str", + }, + "managementRpDetailsList": [{"resourceProviderNamespace": "str"}], + "notificationEmailList": ["str"], + "orderItemMode": "str", + "orderItemStageHistory": [ + { + "displayName": "str", + "stageName": "str", + "stageStatus": "str", + "startTime": "2020-02-20 00:00:00", + } + ], + "preferences": { + "encryptionPreferences": {"doubleEncryptionStatus": "str"}, + "managementResourcePreferences": {"preferredManagementResourceId": "str"}, + "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], + "termCommitmentPreferences": { + "preferredTermCommitmentType": "str", + "preferredTermCommitmentDuration": "1 day, 0:00:00", + }, + "transportPreferences": {"preferredShipmentType": "str"}, + }, + "returnReason": "str", + "returnStatus": "str", + "reverseShippingDetails": { + "carrierDisplayName": "str", + "carrierName": "str", + "sasKeyForLabel": "str", + "trackingId": "str", + "trackingUrl": "str", + }, + "siteDetails": {"siteId": "str"}, + }, + "addressDetails": { + "forwardAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "returnAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + }, + "provisioningState": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_begin_update(self, resource_group): + response = await ( + await self.client.order_item_resources.begin_update( + resource_group_name=resource_group.name, + order_item_name="str", + order_item_update_parameter={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "forwardAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "notificationEmailList": ["str"], + "orderItemDetails": { + "productDetails": { + "parentProvisioningDetails": { + "autoProvisioningStatus": "str", + "devicePresenceVerification": {"message": "str", "status": "str"}, + "managementResourceArmId": "str", + "provisioningArmId": "str", + "provisioningEndPoint": "str", + "quantity": 0, + "readyToConnectArmId": "str", + "serialNumber": "str", + "uniqueDeviceIdentifier": "str", + "vendorName": "str", + } + }, + "siteDetails": {"siteId": "str"}, + }, + "preferences": { + "encryptionPreferences": {"doubleEncryptionStatus": "str"}, + "managementResourcePreferences": {"preferredManagementResourceId": "str"}, + "notificationPreferences": [{"sendNotification": bool, "stageName": "str"}], + "termCommitmentPreferences": { + "preferredTermCommitmentType": "str", + "preferredTermCommitmentDuration": "1 day, 0:00:00", + }, + "transportPreferences": {"preferredShipmentType": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_begin_delete(self, resource_group): + response = await ( + await self.client.order_item_resources.begin_delete( + resource_group_name=resource_group.name, + order_item_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_list_by_resource_group(self, resource_group): + response = self.client.order_item_resources.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_list_by_subscription(self, resource_group): + response = self.client.order_item_resources.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_cancel(self, resource_group): + response = await self.client.order_item_resources.cancel( + resource_group_name=resource_group.name, + order_item_name="str", + cancellation_reason={"reason": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_item_resources_begin_return_order_item(self, resource_group): + response = await ( + await self.client.order_item_resources.begin_return_order_item( + resource_group_name=resource_group.name, + order_item_name="str", + return_order_item_details={ + "returnReason": "str", + "returnAddress": { + "addressClassification": "str", + "addressValidationStatus": "str", + "contactDetails": { + "contactName": "str", + "emailList": ["str"], + "mobile": "str", + "phone": "str", + "phoneExtension": "str", + }, + "provisioningState": "str", + "shippingAddress": { + "country": "str", + "addressType": "str", + "city": "str", + "companyName": "str", + "postalCode": "str", + "stateOrProvince": "str", + "streetAddress1": "str", + "streetAddress2": "str", + "streetAddress3": "str", + "zipExtendedCode": "str", + }, + }, + "serviceTag": "str", + "shippingBoxRequired": bool, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations.py new file mode 100644 index 000000000000..16b21029d477 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrderResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_order_resources_get(self, resource_group): + response = self.client.order_resources.get( + resource_group_name=resource_group.name, + location="str", + order_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations_async.py new file mode 100644 index 000000000000..5fcf271c8adc --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_order_resources_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrderResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_order_resources_get(self, resource_group): + response = await self.client.order_resources.get( + resource_group_name=resource_group.name, + location="str", + order_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations.py new file mode 100644 index 000000000000..70852019cba9 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrdersOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_orders_operation_group_list_by_subscription(self, resource_group): + response = self.client.orders_operation_group.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_orders_operation_group_list_by_resource_group(self, resource_group): + response = self.client.orders_operation_group.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations_async.py new file mode 100644 index 000000000000..ec5d513d2798 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_orders_operation_group_operations_async.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderOrdersOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_orders_operation_group_list_by_subscription(self, resource_group): + response = self.client.orders_operation_group.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_orders_operation_group_list_by_resource_group(self, resource_group): + response = self.client.orders_operation_group.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations.py new file mode 100644 index 000000000000..47996b882502 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderProductsAndConfigurationsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_products_and_configurations_operation_group_list_configurations(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_configurations( + configurations_request={ + "configurationFilter": { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "childConfigurationFilter": { + "childConfigurationTypes": ["str"], + "hierarchyInformations": [ + { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + } + ], + }, + "filterableProperty": [{"supportedValues": ["str"], "type": "str"}], + }, + "customerSubscriptionDetails": { + "quotaId": "str", + "locationPlacementId": "str", + "registeredFeatures": [{"name": "str", "state": "str"}], + }, + }, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_products_and_configurations_operation_group_list_product_families(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_product_families( + product_families_request={ + "filterableProperties": {"str": [{"supportedValues": ["str"], "type": "str"}]}, + "customerSubscriptionDetails": { + "quotaId": "str", + "locationPlacementId": "str", + "registeredFeatures": [{"name": "str", "state": "str"}], + }, + }, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_products_and_configurations_operation_group_list_product_families_metadata(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_product_families_metadata() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations_async.py b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations_async.py new file mode 100644 index 000000000000..5b0c80086efd --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/generated_tests/test_edge_order_products_and_configurations_operation_group_operations_async.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.edgeorder.aio import EdgeOrderClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestEdgeOrderProductsAndConfigurationsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(EdgeOrderClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_products_and_configurations_operation_group_list_configurations(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_configurations( + configurations_request={ + "configurationFilter": { + "hierarchyInformation": { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + }, + "childConfigurationFilter": { + "childConfigurationTypes": ["str"], + "hierarchyInformations": [ + { + "configurationIdDisplayName": "str", + "configurationName": "str", + "productFamilyName": "str", + "productLineName": "str", + "productName": "str", + } + ], + }, + "filterableProperty": [{"supportedValues": ["str"], "type": "str"}], + }, + "customerSubscriptionDetails": { + "quotaId": "str", + "locationPlacementId": "str", + "registeredFeatures": [{"name": "str", "state": "str"}], + }, + }, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_products_and_configurations_operation_group_list_product_families(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_product_families( + product_families_request={ + "filterableProperties": {"str": [{"supportedValues": ["str"], "type": "str"}]}, + "customerSubscriptionDetails": { + "quotaId": "str", + "locationPlacementId": "str", + "registeredFeatures": [{"name": "str", "state": "str"}], + }, + }, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_products_and_configurations_operation_group_list_product_families_metadata(self, resource_group): + response = self.client.products_and_configurations_operation_group.list_product_families_metadata() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/setup.py b/sdk/edgeorder/azure-mgmt-edgeorder/setup.py index d8e8e20c30f7..29912508a31a 100644 --- a/sdk/edgeorder/azure-mgmt-edgeorder/setup.py +++ b/sdk/edgeorder/azure-mgmt-edgeorder/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -55,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -79,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/tsp-location.yaml b/sdk/edgeorder/azure-mgmt-edgeorder/tsp-location.yaml new file mode 100644 index 000000000000..a986b7ea2d37 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edgeorder/EdgeOrder.Management +commit: 1114538fd24217b94902430aa2f9b227f5c55727 +repo: Azure/azure-rest-api-specs +additionalDirectories: