From 7a5cbc2955847ace2628b145c228b0ca45146e39 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 10 Apr 2023 06:05:19 +0000 Subject: [PATCH] CodeGen from PR 23495 in Azure/azure-rest-api-specs Merge 45526ed5ec8244d0836a26b5647b105c1a0130d2 into cb593f0188d2cf5ae2fb168db448e33a72fdee6d --- .../azure-mgmt-azurestackhci/_meta.json | 6 +- .../azurestackhci/_azure_stack_hci_client.py | 88 +- .../mgmt/azurestackhci/_configuration.py | 12 +- .../mgmt/azurestackhci/_serialization.py | 93 +- .../azure/mgmt/azurestackhci/_vendor.py | 5 +- .../azure/mgmt/azurestackhci/_version.py | 2 +- .../aio/_azure_stack_hci_client.py | 89 +- .../mgmt/azurestackhci/aio/_configuration.py | 12 +- .../azurestackhci/aio/operations/__init__.py | 34 +- .../operations/_arc_settings_operations.py | 592 +- .../aio/operations/_clusters_operations.py | 702 +- .../aio/operations/_extensions_operations.py | 317 +- .../_machine_extensions_operations.py | 849 --- .../_marketplacegalleryimages_operations.py | 756 --- .../_networkinterfaces_operations.py | 750 --- .../aio/operations/_offers_operations.py | 339 + .../aio/operations/_operations.py | 12 +- ...perations.py => _publishers_operations.py} | 119 +- .../aio/operations/_skus_operations.py | 247 + .../_storagecontainers_operations.py | 750 --- ...erations.py => _update_runs_operations.py} | 593 +- ...ons.py => _update_summaries_operations.py} | 544 +- ...s_operations.py => _updates_operations.py} | 757 +-- .../_virtualharddisks_operations.py | 750 --- .../operations/_virtualmachines_operations.py | 1113 ---- .../operations/_virtualnetworks_operations.py | 750 --- .../mgmt/azurestackhci/models/__init__.py | 308 +- .../models/_azure_stack_hci_client_enums.py | 263 +- .../mgmt/azurestackhci/models/_models_py3.py | 5701 ++++++----------- .../mgmt/azurestackhci/operations/__init__.py | 34 +- .../operations/_arc_settings_operations.py | 789 ++- .../operations/_clusters_operations.py | 822 ++- .../operations/_extensions_operations.py | 378 +- .../operations/_galleryimages_operations.py | 950 --- .../_machine_extensions_operations.py | 1026 --- .../_marketplacegalleryimages_operations.py | 962 --- .../_networkinterfaces_operations.py | 954 --- .../operations/_offers_operations.py | 458 ++ .../azurestackhci/operations/_operations.py | 16 +- ...perations.py => _publishers_operations.py} | 160 +- .../operations/_skus_operations.py | 339 + .../_storagecontainers_operations.py | 954 --- ...erations.py => _update_runs_operations.py} | 686 +- ...ons.py => _update_summaries_operations.py} | 596 +- ...s_operations.py => _updates_operations.py} | 847 +-- .../_virtualharddisks_operations.py | 952 --- .../operations/_virtualmachines_operations.py | 1414 ---- ...consent_and_install_default_extensions.py} | 9 +- ...tual_machine.py => create_arc_identity.py} | 9 +- .../generated_samples/create_cluster.py | 3 +- ..._machine.py => create_cluster_identity.py} | 8 +- .../generated_samples/delete_arc_setting.py | 2 +- .../generated_samples/delete_cluster.py | 6 +- .../generated_samples/delete_extension.py | 2 +- .../delete_machine_extension.py | 42 - ...tity_metadata.py => delete_update_runs.py} | 15 +- ...st_agent.py => delete_update_summaries.py} | 11 +- ...elete_guest_agent.py => delete_updates.py} | 12 +- .../delete_virtual_machine.py | 41 - .../delete_virtual_network.py | 41 - .../extend_software_assurance_benefit.py | 42 + .../generated_samples/extensions_upgrade.py | 44 + ...tual_hard_disk.py => generate_password.py} | 9 +- .../generated_samples/get_arc_setting.py | 2 +- .../generated_samples/get_cluster.py | 2 +- .../generated_samples/get_extension.py | 2 +- .../generated_samples/get_gallery_image.py | 41 - .../get_machine_extension.py | 42 - .../get_marketplace_gallery_image.py | 41 - .../get_network_interface.py | 41 - ...lete_network_interface.py => get_offer.py} | 10 +- ...et_virtual_machine.py => get_publisher.py} | 9 +- .../{delete_gallery_image.py => get_sku.py} | 11 +- .../get_storage_container.py | 41 - ...dentity_metadata.py => get_update_runs.py} | 13 +- ...guest_agent.py => get_update_summaries.py} | 11 +- .../generated_samples/get_updates.py | 42 + .../get_virtual_hard_disk.py | 41 - .../generated_samples/get_virtual_network.py | 41 - ...ntity_metadata_list_by_virtual_machines.py | 42 - ...chine.py => initialize_disable_process.py} | 9 +- .../list_arc_settings_by_cluster.py | 2 +- .../list_clusters_by_resource_group.py | 2 +- .../list_clusters_by_subscription.py | 2 +- .../list_extensions_by_arc_setting.py | 2 +- .../list_gallery_image_by_subscription.py | 39 - .../list_machine_extension.py | 42 - ...etplace_gallery_image_by_resource_group.py | 41 - ...rketplace_gallery_image_by_subscription.py | 39 - .../list_network_interface_by_subscription.py | 39 - ...rce_group.py => list_offers_by_cluster.py} | 7 +- ...e_group.py => list_offers_by_publisher.py} | 8 +- ...ation_by_cluster.py => list_operations.py} | 6 +- ...group.py => list_publishers_by_cluster.py} | 7 +- ...esource_group.py => list_skus_by_offer.py} | 9 +- .../list_storage_container_by_subscription.py | 39 - ...irtual_machines.py => list_update_runs.py} | 11 +- ...bscription.py => list_update_summaries.py} | 11 +- ...ine_by_subscription.py => list_updates.py} | 11 +- ...ist_virtual_hard_disk_by_resource_group.py | 41 - .../list_virtual_network_by_resource_group.py | 41 - .../list_virtual_network_by_subscription.py | 39 - ..._gallery_image.py => patch_arc_setting.py} | 10 +- .../generated_samples/patch_extension.py | 2 +- .../generated_samples/post_updates.py | 42 + .../generated_samples/put_extension.py | 3 +- .../generated_samples/put_gallery_image.py | 49 - .../put_machine_extension.py | 51 - .../put_marketplace_gallery_image.py | 56 - .../put_network_interface.py | 51 - .../put_storage_container.py | 49 - .../generated_samples/put_update_runs.py | 68 + ...ty_metadata.py => put_update_summaries.py} | 21 +- .../generated_samples/put_updates.py | 69 + .../put_virtual_hard_disk.py | 49 - .../put_virtual_machine_with_gallery_image.py | 60 - ..._machine_with_marketplace_gallery_image.py | 60 - .../put_virtual_machine_with_os_disk.py | 59 - .../generated_samples/put_virtual_network.py | 49 - .../generated_samples/update_cluster.py | 5 +- .../generated_samples/update_gallery_image.py | 42 - .../update_machine_extension.py | 50 - .../update_marketplace_gallery_image.py | 42 - .../update_network_interface.py | 42 - .../update_storage_container.py | 42 - .../update_virtual_hard_disk.py | 42 - .../update_virtual_machine.py | 42 - .../update_virtual_network.py | 42 - .../generated_samples/upload_certificate.py | 42 + 129 files changed, 9533 insertions(+), 21671 deletions(-) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_offers_operations.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/{_guest_agents_operations.py => _publishers_operations.py} (55%) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_skus_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/{_guest_agent_operations.py => _update_runs_operations.py} (52%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/{_hybrid_identity_metadata_operations.py => _update_summaries_operations.py} (58%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/{_galleryimages_operations.py => _updates_operations.py} (50%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_offers_operations.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/{_guest_agents_operations.py => _publishers_operations.py} (51%) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_skus_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/{_guest_agent_operations.py => _update_runs_operations.py} (52%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/{_hybrid_identity_metadata_operations.py => _update_summaries_operations.py} (62%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/{_virtualnetworks_operations.py => _updates_operations.py} (52%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_storage_container.py => consent_and_install_default_extensions.py} (82%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{restart_virtual_machine.py => create_arc_identity.py} (85%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{stop_virtual_machine.py => create_cluster_identity.py} (86%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_hybrid_identity_metadata.py => delete_update_runs.py} (77%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{create_guest_agent.py => delete_update_summaries.py} (81%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_guest_agent.py => delete_updates.py} (81%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extend_software_assurance_benefit.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extensions_upgrade.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_virtual_hard_disk.py => generate_password.py} (85%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_network_interface.py => get_offer.py} (85%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{get_virtual_machine.py => get_publisher.py} (86%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_gallery_image.py => get_sku.py} (84%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{create_hybrid_identity_metadata.py => get_update_runs.py} (78%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{get_guest_agent.py => get_update_summaries.py} (82%) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_updates.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{start_virtual_machine.py => initialize_disable_process.py} (83%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_gallery_image_by_resource_group.py => list_offers_by_cluster.py} (86%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_network_interface_by_resource_group.py => list_offers_by_publisher.py} (85%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_operation_by_cluster.py => list_operations.py} (87%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_virtual_machine_by_resource_group.py => list_publishers_by_cluster.py} (86%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_storage_container_by_resource_group.py => list_skus_by_offer.py} (84%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{guest_agent_list_by_virtual_machines.py => list_update_runs.py} (80%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_virtual_hard_disk_by_subscription.py => list_update_summaries.py} (80%) rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{list_virtual_machine_by_subscription.py => list_updates.py} (82%) delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{delete_marketplace_gallery_image.py => patch_arc_setting.py} (81%) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/post_updates.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_runs.py rename sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/{get_hybrid_identity_metadata.py => put_update_summaries.py} (66%) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_updates.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/upload_certificate.py diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json index 2cfc7462ed69..0bd31b229b23 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json @@ -1,11 +1,11 @@ { - "commit": "85ea3e489c45e80383801d4f3a1278f1e687a7b8", + "commit": "5a7819bec76440a50ce1d7e71c64cb7141c43bdb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/azurestackhci/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-preview-2021-09 --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/azurestackhci/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/azurestackhci/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py index 32e0c50c3a1f..8363339433c3 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py @@ -19,18 +19,13 @@ ArcSettingsOperations, ClustersOperations, ExtensionsOperations, - GalleryimagesOperations, - GuestAgentOperations, - GuestAgentsOperations, - HybridIdentityMetadataOperations, - MachineExtensionsOperations, - MarketplacegalleryimagesOperations, - NetworkinterfacesOperations, + OffersOperations, Operations, - StoragecontainersOperations, - VirtualharddisksOperations, - VirtualmachinesOperations, - VirtualnetworksOperations, + PublishersOperations, + SkusOperations, + UpdateRunsOperations, + UpdateSummariesOperations, + UpdatesOperations, ) if TYPE_CHECKING: @@ -47,40 +42,28 @@ class AzureStackHCIClient: # pylint: disable=client-accepts-api-version-keyword :vartype clusters: azure.mgmt.azurestackhci.operations.ClustersOperations :ivar extensions: ExtensionsOperations operations :vartype extensions: azure.mgmt.azurestackhci.operations.ExtensionsOperations - :ivar galleryimages: GalleryimagesOperations operations - :vartype galleryimages: azure.mgmt.azurestackhci.operations.GalleryimagesOperations - :ivar marketplacegalleryimages: MarketplacegalleryimagesOperations operations - :vartype marketplacegalleryimages: - azure.mgmt.azurestackhci.operations.MarketplacegalleryimagesOperations - :ivar networkinterfaces: NetworkinterfacesOperations operations - :vartype networkinterfaces: azure.mgmt.azurestackhci.operations.NetworkinterfacesOperations + :ivar offers: OffersOperations operations + :vartype offers: azure.mgmt.azurestackhci.operations.OffersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.azurestackhci.operations.Operations - :ivar storagecontainers: StoragecontainersOperations operations - :vartype storagecontainers: azure.mgmt.azurestackhci.operations.StoragecontainersOperations - :ivar virtualharddisks: VirtualharddisksOperations operations - :vartype virtualharddisks: azure.mgmt.azurestackhci.operations.VirtualharddisksOperations - :ivar virtualmachines: VirtualmachinesOperations operations - :vartype virtualmachines: azure.mgmt.azurestackhci.operations.VirtualmachinesOperations - :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations - :vartype hybrid_identity_metadata: - azure.mgmt.azurestackhci.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: azure.mgmt.azurestackhci.operations.MachineExtensionsOperations - :ivar guest_agent: GuestAgentOperations operations - :vartype guest_agent: azure.mgmt.azurestackhci.operations.GuestAgentOperations - :ivar guest_agents: GuestAgentsOperations operations - :vartype guest_agents: azure.mgmt.azurestackhci.operations.GuestAgentsOperations - :ivar virtualnetworks: VirtualnetworksOperations operations - :vartype virtualnetworks: azure.mgmt.azurestackhci.operations.VirtualnetworksOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.azurestackhci.operations.PublishersOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.azurestackhci.operations.SkusOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: azure.mgmt.azurestackhci.operations.UpdateRunsOperations + :ivar update_summaries: UpdateSummariesOperations operations + :vartype update_summaries: azure.mgmt.azurestackhci.operations.UpdateSummariesOperations + :ivar updates: UpdatesOperations operations + :vartype updates: azure.mgmt.azurestackhci.operations.UpdatesOperations :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-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-03-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. @@ -96,7 +79,7 @@ def __init__( self._config = AzureStackHCIClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -105,30 +88,15 @@ def __init__( self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplacegalleryimages = MarketplacegalleryimagesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.networkinterfaces = NetworkinterfacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.offers = OffersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storagecontainers = StoragecontainersOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtualharddisks = VirtualharddisksOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.machine_extensions = MachineExtensionsOperations( + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_summaries = UpdateSummariesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.guest_agent = GuestAgentOperations(self._client, self._config, self._serialize, self._deserialize) - self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtualnetworks = VirtualnetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.updates = UpdatesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -159,5 +127,5 @@ def __enter__(self) -> "AzureStackHCIClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py index 7ddbc1d85b55..26dcde2fdd4d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-03-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: super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py index 2c170e28dbca..842ae727fbbc 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1361,7 @@ class Deserializer(object): 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}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py index c160c9dda494..22f478d49736 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py @@ -19,18 +19,13 @@ ArcSettingsOperations, ClustersOperations, ExtensionsOperations, - GalleryimagesOperations, - GuestAgentOperations, - GuestAgentsOperations, - HybridIdentityMetadataOperations, - MachineExtensionsOperations, - MarketplacegalleryimagesOperations, - NetworkinterfacesOperations, + OffersOperations, Operations, - StoragecontainersOperations, - VirtualharddisksOperations, - VirtualmachinesOperations, - VirtualnetworksOperations, + PublishersOperations, + SkusOperations, + UpdateRunsOperations, + UpdateSummariesOperations, + UpdatesOperations, ) if TYPE_CHECKING: @@ -47,41 +42,28 @@ class AzureStackHCIClient: # pylint: disable=client-accepts-api-version-keyword :vartype clusters: azure.mgmt.azurestackhci.aio.operations.ClustersOperations :ivar extensions: ExtensionsOperations operations :vartype extensions: azure.mgmt.azurestackhci.aio.operations.ExtensionsOperations - :ivar galleryimages: GalleryimagesOperations operations - :vartype galleryimages: azure.mgmt.azurestackhci.aio.operations.GalleryimagesOperations - :ivar marketplacegalleryimages: MarketplacegalleryimagesOperations operations - :vartype marketplacegalleryimages: - azure.mgmt.azurestackhci.aio.operations.MarketplacegalleryimagesOperations - :ivar networkinterfaces: NetworkinterfacesOperations operations - :vartype networkinterfaces: azure.mgmt.azurestackhci.aio.operations.NetworkinterfacesOperations + :ivar offers: OffersOperations operations + :vartype offers: azure.mgmt.azurestackhci.aio.operations.OffersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.azurestackhci.aio.operations.Operations - :ivar storagecontainers: StoragecontainersOperations operations - :vartype storagecontainers: azure.mgmt.azurestackhci.aio.operations.StoragecontainersOperations - :ivar virtualharddisks: VirtualharddisksOperations operations - :vartype virtualharddisks: azure.mgmt.azurestackhci.aio.operations.VirtualharddisksOperations - :ivar virtualmachines: VirtualmachinesOperations operations - :vartype virtualmachines: azure.mgmt.azurestackhci.aio.operations.VirtualmachinesOperations - :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations - :vartype hybrid_identity_metadata: - azure.mgmt.azurestackhci.aio.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: - azure.mgmt.azurestackhci.aio.operations.MachineExtensionsOperations - :ivar guest_agent: GuestAgentOperations operations - :vartype guest_agent: azure.mgmt.azurestackhci.aio.operations.GuestAgentOperations - :ivar guest_agents: GuestAgentsOperations operations - :vartype guest_agents: azure.mgmt.azurestackhci.aio.operations.GuestAgentsOperations - :ivar virtualnetworks: VirtualnetworksOperations operations - :vartype virtualnetworks: azure.mgmt.azurestackhci.aio.operations.VirtualnetworksOperations + :ivar publishers: PublishersOperations operations + :vartype publishers: azure.mgmt.azurestackhci.aio.operations.PublishersOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.azurestackhci.aio.operations.SkusOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: azure.mgmt.azurestackhci.aio.operations.UpdateRunsOperations + :ivar update_summaries: UpdateSummariesOperations operations + :vartype update_summaries: azure.mgmt.azurestackhci.aio.operations.UpdateSummariesOperations + :ivar updates: UpdatesOperations operations + :vartype updates: azure.mgmt.azurestackhci.aio.operations.UpdatesOperations :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-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-03-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. @@ -97,7 +79,7 @@ def __init__( self._config = AzureStackHCIClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -106,30 +88,15 @@ def __init__( self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplacegalleryimages = MarketplacegalleryimagesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.networkinterfaces = NetworkinterfacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.offers = OffersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storagecontainers = StoragecontainersOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtualharddisks = VirtualharddisksOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.machine_extensions = MachineExtensionsOperations( + self.publishers = PublishersOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_summaries = UpdateSummariesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.guest_agent = GuestAgentOperations(self._client, self._config, self._serialize, self._deserialize) - self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtualnetworks = VirtualnetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.updates = UpdatesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -160,5 +127,5 @@ async def __aenter__(self) -> "AzureStackHCIClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py index 5013392e2f10..ea277a6ad3c1 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-03-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: super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py index ed88648db311..4f2531a63b22 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py @@ -9,18 +9,13 @@ from ._arc_settings_operations import ArcSettingsOperations from ._clusters_operations import ClustersOperations from ._extensions_operations import ExtensionsOperations -from ._galleryimages_operations import GalleryimagesOperations -from ._marketplacegalleryimages_operations import MarketplacegalleryimagesOperations -from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._offers_operations import OffersOperations from ._operations import Operations -from ._storagecontainers_operations import StoragecontainersOperations -from ._virtualharddisks_operations import VirtualharddisksOperations -from ._virtualmachines_operations import VirtualmachinesOperations -from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._guest_agent_operations import GuestAgentOperations -from ._guest_agents_operations import GuestAgentsOperations -from ._virtualnetworks_operations import VirtualnetworksOperations +from ._publishers_operations import PublishersOperations +from ._skus_operations import SkusOperations +from ._update_runs_operations import UpdateRunsOperations +from ._update_summaries_operations import UpdateSummariesOperations +from ._updates_operations import UpdatesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -30,18 +25,13 @@ "ArcSettingsOperations", "ClustersOperations", "ExtensionsOperations", - "GalleryimagesOperations", - "MarketplacegalleryimagesOperations", - "NetworkinterfacesOperations", + "OffersOperations", "Operations", - "StoragecontainersOperations", - "VirtualharddisksOperations", - "VirtualmachinesOperations", - "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", - "GuestAgentOperations", - "GuestAgentsOperations", - "VirtualnetworksOperations", + "PublishersOperations", + "SkusOperations", + "UpdateRunsOperations", + "UpdateSummariesOperations", + "UpdatesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py index 784c4f3f6ce9..7ffb43c14828 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,16 +31,17 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._arc_settings_operations import ( + build_consent_and_install_default_extensions_request, + build_create_identity_request, build_create_request, build_delete_request, + build_generate_password_request, build_get_request, + build_initialize_disable_process_request, build_list_by_cluster_request, + build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +84,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ArcSettingList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +138,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,9 +187,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ArcSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -206,8 +203,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,7 +312,7 @@ async def create( information. Required. :type arc_setting_name: str :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Is either a model type or a IO type. Required. + Is either a ArcSetting type or a IO type. Required. :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -335,9 +333,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ArcSetting] = kwargs.pop("cls", None) @@ -365,8 +361,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,6 +384,162 @@ async def create( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" } + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: _models.ArcSettingsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Required. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Required. + :type arc_setting: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: Union[_models.ArcSettingsPatch, IO], + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Is either a + ArcSettingsPatch type or a IO type. Required. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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[_models.ArcSetting] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(arc_setting, (IO, bytes)): + _content = arc_setting + else: + _json = self._serialize.body(arc_setting, "ArcSettingsPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ArcSetting", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + } + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any ) -> None: @@ -401,9 +554,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -419,8 +570,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,9 +618,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -511,3 +661,395 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" } + + @distributed_trace_async + async def generate_password( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> _models.PasswordCredential: + """Generate password for arc settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PasswordCredential or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.PasswordCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.PasswordCredential] = kwargs.pop("cls", None) + + request = build_generate_password_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_password.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PasswordCredential", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_password.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword" + } + + async def _create_identity_initial( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> Optional[_models.ArcIdentityResponse]: + error_map = { + 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[Optional[_models.ArcIdentityResponse]] = kwargs.pop("cls", None) + + request = build_create_identity_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._create_identity_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ArcIdentityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" + } + + @distributed_trace_async + async def begin_create_identity( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ArcIdentityResponse]: + """Create Aad identity for arc settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ArcIdentityResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.ArcIdentityResponse] + :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.ArcIdentityResponse] = 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ArcIdentityResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_identity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" + } + + @distributed_trace_async + async def consent_and_install_default_extensions( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> _models.ArcSetting: + """Add consent time for default extensions and initiate extensions installation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.ArcSetting] = kwargs.pop("cls", None) + + request = build_consent_and_install_default_extensions_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.consent_and_install_default_extensions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ArcSetting", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + consent_and_install_default_extensions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/consentAndInstallDefaultExtensions" + } + + async def _initialize_disable_process_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_initialize_disable_process_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._initialize_disable_process_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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, None, {}) + + _initialize_disable_process_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + } + + @distributed_trace_async + async def begin_initialize_disable_process( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initializes ARC Disable process on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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._initialize_disable_process_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_initialize_disable_process.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py index ba3dfc5242af..36a40d39519a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,27 +20,28 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._clusters_operations import ( + build_create_identity_request, build_create_request, build_delete_request, + build_extend_software_assurance_benefit_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request, + build_upload_certificate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,9 +77,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -131,8 +129,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,9 +163,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -219,8 +216,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,9 +260,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -279,8 +275,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -368,7 +365,7 @@ async def create( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. + :param cluster: Details of the HCI cluster. Is either a Cluster type or a IO type. Required. :type cluster: ~azure.mgmt.azurestackhci.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -389,9 +386,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) @@ -418,8 +413,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,7 +503,8 @@ async def update( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. + :param cluster: Details of the HCI cluster. Is either a ClusterPatch type or a IO type. + Required. :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -528,9 +525,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) @@ -557,8 +552,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -579,10 +575,56 @@ async def update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -591,10 +633,67 @@ async def delete( # pylint: disable=inconsistent-return-statements :param cluster_name: The name of the cluster. Required. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + } + + async def _upload_certificate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: Union[_models.UploadCertificateRequest, IO], + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -603,33 +702,44 @@ async def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) - request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(upload_certificate_request, (IO, bytes)): + _content = upload_certificate_request + else: + _json = self._serialize.body(upload_certificate_request, "UploadCertificateRequest") + + request = build_upload_certificate_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self._upload_certificate_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: 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) @@ -637,6 +747,514 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + _upload_certificate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" + } + + @overload + async def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: _models.UploadCertificateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Required. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @overload + async def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Required. + :type upload_certificate_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @distributed_trace_async + async def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: Union[_models.UploadCertificateRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Is either a + UploadCertificateRequest type or a IO type. Required. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 {}) + + 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._upload_certificate_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + upload_certificate_request=upload_certificate_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upload_certificate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" + } + + async def _create_identity_initial( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Optional[_models.ClusterIdentityResponse]: + error_map = { + 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[Optional[_models.ClusterIdentityResponse]] = kwargs.pop("cls", None) + + request = build_create_identity_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._create_identity_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ClusterIdentityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" + } + + @distributed_trace_async + async def begin_create_identity( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterIdentityResponse]: + """Create cluster identity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ClusterIdentityResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.ClusterIdentityResponse] + :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.ClusterIdentityResponse] = 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ClusterIdentityResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_identity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" + } + + async def _extend_software_assurance_benefit_initial( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: Union[_models.SoftwareAssuranceChangeRequest, IO], + **kwargs: Any + ) -> Optional[_models.Cluster]: + error_map = { + 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[Optional[_models.Cluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(software_assurance_change_request, (IO, bytes)): + _content = software_assurance_change_request + else: + _json = self._serialize.body(software_assurance_change_request, "SoftwareAssuranceChangeRequest") + + request = build_extend_software_assurance_benefit_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._extend_software_assurance_benefit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("Cluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _extend_software_assurance_benefit_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" + } + + @overload + async def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: _models.SoftwareAssuranceChangeRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Required. + :type software_assurance_change_request: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Required. + :type software_assurance_change_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: Union[_models.SoftwareAssuranceChangeRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Is either + a SoftwareAssuranceChangeRequest type or a IO type. Required. + :type software_assurance_change_request: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :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.Cluster] = 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._extend_software_assurance_benefit_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + software_assurance_change_request=software_assurance_change_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_extend_software_assurance_benefit.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py index 5b8b6786d8ae..583b1b6ae20d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,12 +36,9 @@ build_get_request, build_list_by_arc_setting_request, build_update_request, + build_upgrade_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,9 +84,7 @@ def list_by_arc_setting( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExtensionList] = kwargs.pop("cls", None) error_map = { @@ -145,8 +139,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,9 +190,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) request = build_get_request( @@ -214,8 +207,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,9 +250,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) @@ -287,8 +279,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,8 +414,8 @@ async def begin_create( :type arc_setting_name: str :param extension_name: The name of the machine extension. Required. :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. + :param extension: Details of the Machine Extension to be created. Is either a Extension type or + a IO type. Required. :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -443,9 +436,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -503,7 +494,7 @@ async def _update_initial( extension_name: str, extension: Union[_models.Extension, IO], **kwargs: Any - ) -> _models.Extension: + ) -> Optional[_models.Extension]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -515,11 +506,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.Extension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -546,18 +535,21 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: 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("Extension", pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -676,8 +668,8 @@ async def begin_update( :type arc_setting_name: str :param extension_name: The name of the machine extension. Required. :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. + :param extension: Details of the Machine Extension to be created. Is either a Extension type or + a IO type. Required. :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -698,9 +690,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -764,9 +754,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -783,8 +771,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -832,9 +821,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -878,3 +865,249 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" } + + async def _upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: Union[_models.ExtensionUpgradeParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_upgrade_parameters, (IO, bytes)): + _content = extension_upgrade_parameters + else: + _json = self._serialize.body(extension_upgrade_parameters, "ExtensionUpgradeParameters") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202]: + 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, None, {}) + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + } + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: _models.ExtensionUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: ~azure.mgmt.azurestackhci.models.ExtensionUpgradeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @distributed_trace_async + async def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: Union[_models.ExtensionUpgradeParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Is either a ExtensionUpgradeParameters type or a IO type. Required. + :type extension_upgrade_parameters: ~azure.mgmt.azurestackhci.models.ExtensionUpgradeParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 {}) + + 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._upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + extension_upgrade_parameters=extension_upgrade_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py deleted file mode 100644 index 05fc1e1bab77..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,849 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._machine_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_virtual_machines_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_or_update_initial( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.MachineExtension] = 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_or_update_initial( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - async def _update_initial( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.MachineExtension] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 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) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be deleted. Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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_initial( # type: ignore - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any - ) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_virtual_machines_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py deleted file mode 100644 index e59769c23c65..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_marketplacegalleryimages_operations.py +++ /dev/null @@ -1,756 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._marketplacegalleryimages_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MarketplacegalleryimagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`marketplacegalleryimages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Gets marketplacegalleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Marketplacegalleryimages] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages - else: - _json = self._serialize.body(marketplacegalleryimages, "Marketplacegalleryimages") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.Marketplacegalleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Marketplacegalleryimages or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Marketplacegalleryimages or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Marketplacegalleryimages or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = 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_or_update_initial( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - marketplacegalleryimages=marketplacegalleryimages, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> None: - """Deletes a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.MarketplacegalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.MarketplacegalleryimagesPatch, IO], - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages - else: - _json = self._serialize.body(marketplacegalleryimages, "MarketplacegalleryimagesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py deleted file mode 100644 index 810b9cda4869..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._networkinterfaces_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkinterfacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`networkinterfaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> _models.Networkinterfaces: - """Gets network interfaces by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Networkinterfaces] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "Networkinterfaces") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.Networkinterfaces, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = 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_or_update_initial( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - networkinterfaces=networkinterfaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.NetworkinterfacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.NetworkinterfacesPatch, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "NetworkinterfacesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Networkinterfaces"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Networkinterfaces"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_offers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_offers_operations.py new file mode 100644 index 000000000000..415bec7d9de8 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_offers_operations.py @@ -0,0 +1,339 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._offers_operations import ( + build_get_request, + build_list_by_cluster_request, + build_list_by_publisher_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OffersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s + :attr:`offers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Offer"]: + """List Offers available for a publisher within the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Offer] + :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.OfferList] = kwargs.pop("cls", None) + + error_map = { + 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_by_publisher_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_publisher.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OfferList", 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) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers" + } + + @distributed_trace + def list_by_cluster( + self, resource_group_name: str, cluster_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Offer"]: + """List Offers available across publishers for the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Offer] + :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.OfferList] = kwargs.pop("cls", None) + + error_map = { + 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_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OfferList", 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) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Offer: + """Get Offer resource details within a publisher of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Offer or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Offer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Offer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Offer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py index 3c8ce63b1b71..dd791c2225c6 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,9 +70,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -89,8 +82,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_publishers_operations.py similarity index 55% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_publishers_operations.py index 2eab54512479..e69f156b1e2d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agents_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_publishers_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -23,29 +22,26 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._guest_agents_operations import build_list_by_virtual_machines_request +from ...operations._publishers_operations import build_get_request, build_list_by_cluster_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class GuestAgentsOperations: +class PublishersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`guest_agents` attribute. + :attr:`publishers` attribute. """ models = _models @@ -58,30 +54,26 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GuestAgent"]: - """Implements GET GuestAgent in a vm. - - Returns the list of GuestAgent of the given vm. + def list_by_cluster( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Publisher"]: + """List Publishers available for the HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestAgent or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GuestAgent] + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Publisher] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublisherList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,12 +86,12 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( + request = build_list_by_cluster_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -125,7 +117,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("GuestAgentList", pipeline_response) + deserialized = self._deserialize("PublisherList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -134,8 +126,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,6 +141,74 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents" + list_by_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, cluster_name: str, publisher_name: str, **kwargs: Any + ) -> _models.Publisher: + """Get Publisher resource details of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Publisher] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_skus_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..35385903f4d7 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_skus_operations.py @@ -0,0 +1,247 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_get_request, build_list_by_offer_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s + :attr:`skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_offer( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Sku"]: + """List Skus available for a offer within the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Sku or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Sku] + :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.SkuList] = kwargs.pop("cls", None) + + error_map = { + 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_by_offer_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_offer.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SkuList", 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) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_offer.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + sku_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Sku: + """Get SKU resource details within a offer of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param sku_name: The name of the SKU available within HCI cluster. Required. + :type sku_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Sku or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Sku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Sku] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Sku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py deleted file mode 100644 index e4b00ee36bb2..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_storagecontainers_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._storagecontainers_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StoragecontainersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`storagecontainers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> _models.Storagecontainers: - """Gets storagecontainers by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Storagecontainers] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], - **kwargs: Any - ) -> _models.Storagecontainers: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Storagecontainers] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers - else: - _json = self._serialize.body(storagecontainers, "Storagecontainers") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.Storagecontainers, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Storagecontainers] = 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_or_update_initial( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - storagecontainers=storagecontainers, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Storagecontainers", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @overload - async def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.StoragecontainersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.StoragecontainersPatch, IO], - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Storagecontainers] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers - else: - _json = self._serialize.body(storagecontainers, "StoragecontainersPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Storagecontainers"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Storagecontainers"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_runs_operations.py similarity index 52% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_runs_operations.py index 13de1629bc2b..f652a16a60e2 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_guest_agent_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_runs_operations.py @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -21,6 +22,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,24 +30,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._guest_agent_operations import build_create_request, build_delete_request, build_get_request +from ...operations._update_runs_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_put_request, +) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class GuestAgentOperations: +class UpdateRunsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`guest_agent` attribute. + :attr:`update_runs` attribute. """ models = _models @@ -57,14 +60,30 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _create_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any - ) -> _models.GuestAgent: + @distributed_trace + def list( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UpdateRun"]: + """List all Update runs for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateRun or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.UpdateRun] + :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.UpdateRunList] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -73,175 +92,140 @@ async def _create_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 {}) - - api_version: Literal["2021-09-01-preview"] = 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.GuestAgent] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "GuestAgent") else: - _json = None + # 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateRunList", 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) - request = build_create_request( + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202, 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) - if response.status_code == 200: - deserialized = self._deserialize("GuestAgent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GuestAgent", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - @overload - async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[_models.GuestAgent] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.GuestAgent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. + async def begin_delete( + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specified Update Run. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.GuestAgent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -250,30 +234,25 @@ async def begin_create( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GuestAgent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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.GuestAgent] = kwargs.pop("cls", None) + 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._create_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - body=body, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -281,11 +260,9 @@ async def begin_create( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GuestAgent", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: AsyncPollingMethod = cast( @@ -305,28 +282,108 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> _models.GuestAgent: - """Gets GuestAgent. + @overload + async def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: _models.UpdateRun, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. - Implements GuestAgent GET method. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Required. + :type update_runs_properties: ~azure.mgmt.azurestackhci.models.UpdateRun + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Required. + :type update_runs_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: GuestAgent or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.GuestAgent + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: Union[_models.UpdateRun, IO], + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Is either a UpdateRun type + or a IO type. Required. + :type update_runs_properties: ~azure.mgmt.azurestackhci.models.UpdateRun or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -337,29 +394,41 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + 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.UpdateRun] = kwargs.pop("cls", None) - request = build_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_runs_properties, (IO, bytes)): + _content = update_runs_properties + else: + _json = self._serialize.body(update_runs_properties, "UpdateRun") + + request = build_put_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,20 +438,37 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = self._deserialize("UpdateRun", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> None: + @distributed_trace_async + async def get( + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> _models.UpdateRun: + """Get the Update run for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -394,111 +480,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - request = build_delete_request( + request = build_get_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + 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]: 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, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an GuestAgent. - - Implements GuestAgent DELETE method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + deserialized = self._deserialize("UpdateRun", pipeline_response) - api_version: Literal["2021-09-01-preview"] = 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_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + if cls: + return cls(pipeline_response, deserialized, {}) - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return deserialized - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_summaries_operations.py similarity index 58% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_summaries_operations.py index c2710f9ccf7a..ed25f4a4cf19 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_update_summaries_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,37 +20,35 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._hybrid_identity_metadata_operations import ( - build_create_request, +from ...operations._update_summaries_operations import ( build_delete_request, build_get_request, - build_list_by_virtual_machines_request, + build_list_request, + build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class HybridIdentityMetadataOperations: +class UpdateSummariesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`hybrid_identity_metadata` attribute. + :attr:`update_summaries` attribute. """ models = _models @@ -63,100 +60,300 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UpdateSummaries"]: + """List all Update summaries under the HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateSummaries or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.UpdateSummaries] + :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.UpdateSummariesList] = kwargs.pop("cls", None) + + error_map = { + 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_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateSummariesList", 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) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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]: + 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete Update Summaries. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + } + @overload - async def create( + async def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[_models.HybridIdentityMetadata] = None, + cluster_name: str, + update_location_properties: _models.UpdateSummaries, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Required. + :type update_location_properties: ~azure.mgmt.azurestackhci.models.UpdateSummaries :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( + async def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[IO] = None, + cluster_name: str, + update_location_properties: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Required. + :type update_location_properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create( + async def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, + cluster_name: str, + update_location_properties: Union[_models.UpdateSummaries, IO], **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata or IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Is either a + UpdateSummaries type or a IO type. Required. + :type update_location_properties: ~azure.mgmt.azurestackhci.models.UpdateSummaries or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -170,41 +367,36 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.HybridIdentityMetadata] = kwargs.pop("cls", None) + cls: ClsType[_models.UpdateSummaries] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): - _content = body + if isinstance(update_location_properties, (IO, bytes)): + _content = update_location_properties else: - if body is not None: - _json = self._serialize.body(body, "HybridIdentityMetadata") - else: - _json = None + _json = self._serialize.body(update_location_properties, "UpdateSummaries") - request = build_create_request( + request = build_put_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,35 +406,29 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("UpdateSummaries", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" } @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Gets HybridIdentityMetadata. - - Implements HybridIdentityMetadata GET method. + async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.UpdateSummaries: + """Get all Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -256,15 +442,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UpdateSummaries] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -274,8 +457,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,7 +469,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("UpdateSummaries", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -293,169 +477,5 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> None: - """Deletes an HybridIdentityMetadata. - - Implements HybridIdentityMetadata DELETE method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.HybridIdentityMetadata"]: - """Implements GET HybridIdentityMetadata in a vm. - - Returns the list of HybridIdentityMetadata of the given vm. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridIdentityMetadata or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.HybridIdentityMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) - - error_map = { - 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_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("HybridIdentityMetadataList", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_updates_operations.py similarity index 50% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_updates_operations.py index 3d719138215d..9b24970ab0e2 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_updates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,31 +30,26 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._galleryimages_operations import ( - build_create_or_update_request, +from ...operations._updates_operations import ( build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, + build_get_request, + build_list_request, + build_post_request, + build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class GalleryimagesOperations: +class UpdatesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`galleryimages` attribute. + :attr:`updates` attribute. """ models = _models @@ -67,20 +61,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def retrieve(self, resource_group_name: str, galleryimages_name: str, **kwargs: Any) -> _models.Galleryimages: - """Gets galleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _post_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -92,210 +75,60 @@ async def retrieve(self, resource_group_name: str, galleryimages_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Galleryimages] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> _models.Galleryimages: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "Galleryimages") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_create_or_update_request( + request = build_post_request( resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._post_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: 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 response.status_code == 200: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" } - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.Galleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Galleryimages]: - """Create or update a gallery image. + async def begin_post( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Apply Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -304,29 +137,24 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) + 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._create_or_update_initial( + raw_result = await self._post_initial( # type: ignore resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - galleryimages=galleryimages, + cluster_name=cluster_name, + update_name=update_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -334,11 +162,9 @@ async def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Galleryimages", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: AsyncPollingMethod = cast( @@ -358,26 +184,103 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, galleryimages_name: str, **kwargs: Any - ) -> None: - """Delete a gallery image. + @distributed_trace + def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterable["_models.Update"]: + """List all Updates. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: An iterator like instance of either Update or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Update] :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.UpdateList] = kwargs.pop("cls", None) + + error_map = { + 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_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateList", 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) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -389,120 +292,208 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 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) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specified Update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } @overload - async def update( + async def put( self, resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.GalleryimagesPatch, + cluster_name: str, + update_name: str, + update_properties: _models.Update, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Required. + :type update_properties: ~azure.mgmt.azurestackhci.models.Update :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def put( self, resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, + cluster_name: str, + update_name: str, + update_properties: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Required. + :type update_properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def put( self, resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.GalleryimagesPatch, IO], + cluster_name: str, + update_name: str, + update_properties: Union[_models.Update, IO], **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch or IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Is either a Update type or a IO + type. Required. + :type update_properties: ~azure.mgmt.azurestackhci.models.Update or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -516,81 +507,73 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Galleryimages] = kwargs.pop("cls", None) + cls: ClsType[_models.Update] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages + if isinstance(update_properties, (IO, bytes)): + _content = update_properties else: - _json = self._serialize.body(galleryimages, "GalleryimagesPatch") + _json = self._serialize.body(update_properties, "Update") - request = build_update_request( + request = build_put_request( resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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 response.status_code == 200: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) + deserialized = self._deserialize("Update", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Galleryimages"]: - """Lists all galleryimages under the resource group. + @distributed_trace_async + async def get(self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any) -> _models.Update: + """Get specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -599,146 +582,44 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryimagesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Galleryimages"]: - """List all galleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Update] = 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryimagesListResult", 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 = False + 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 - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - 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("Update", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged(get_next, extract_data) + return deserialized - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py deleted file mode 100644 index 2d24c2b99fc5..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._virtualharddisks_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VirtualharddisksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualharddisks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any - ) -> _models.Virtualharddisks: - """Gets virtualharddisks by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualharddisks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], - **kwargs: Any - ) -> _models.Virtualharddisks: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks - else: - _json = self._serialize.body(virtualharddisks, "Virtualharddisks") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.Virtualharddisks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = 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_or_update_initial( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - virtualharddisks=virtualharddisks, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @overload - async def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.VirtualharddisksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.VirtualharddisksPatch, IO], - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks - else: - _json = self._serialize.body(virtualharddisks, "VirtualharddisksPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualharddisks"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualharddisks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py deleted file mode 100644 index 86da05462c96..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py +++ /dev/null @@ -1,1113 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._virtualmachines_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_restart_request, - build_retrieve_request, - build_start_request, - build_stop_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VirtualmachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualmachines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> _models.Virtualmachines: - """Gets virtual machines by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualmachines] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> _models.Virtualmachines: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualmachines] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines - else: - _json = self._serialize.body(virtualmachines, "Virtualmachines") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.Virtualmachines, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualmachines] = 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_or_update_initial( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - virtualmachines=virtualmachines, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualmachines", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @overload - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.VirtualmachinesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.VirtualmachinesPatch, IO], - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualmachines] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines - else: - _json = self._serialize.body(virtualmachines, "VirtualmachinesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" - } - - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """start. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" - } - - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_stop_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" - } - - @distributed_trace_async - async def begin_stop( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """stop. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" - } - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" - } - - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """restart. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualmachines"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualmachines"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py deleted file mode 100644 index 37465297af00..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._virtualnetworks_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VirtualnetworksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.aio.AzureStackHCIClient`'s - :attr:`virtualnetworks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> _models.Virtualnetworks: - """retrieve. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualnetworks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "Virtualnetworks") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.Virtualnetworks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = 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_or_update_initial( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - virtualnetworks=virtualnetworks, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @overload - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.VirtualnetworksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.VirtualnetworksPatch, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "VirtualnetworksPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Virtualnetworks"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Virtualnetworks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualnetworksListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py index 45dee4371d71..3ca9012929dc 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py @@ -6,299 +6,171 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ArcConnectivityProperties +from ._models_py3 import ArcIdentityResponse from ._models_py3 import ArcSetting from ._models_py3 import ArcSettingList +from ._models_py3 import ArcSettingsPatch from ._models_py3 import Cluster from ._models_py3 import ClusterDesiredProperties +from ._models_py3 import ClusterIdentityResponse from ._models_py3 import ClusterList from ._models_py3 import ClusterNode from ._models_py3 import ClusterPatch from ._models_py3 import ClusterReportedProperties -from ._models_py3 import ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable -from ._models_py3 import ( - ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems, -) +from ._models_py3 import DefaultExtensionDetails from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse -from ._models_py3 import ExtendedLocation from ._models_py3 import Extension +from ._models_py3 import ExtensionInstanceView +from ._models_py3 import ExtensionInstanceViewStatus from ._models_py3 import ExtensionList -from ._models_py3 import GalleryDiskImage -from ._models_py3 import GalleryImageIdentifier -from ._models_py3 import GalleryImageStatus -from ._models_py3 import GalleryImageStatusDownloadStatus -from ._models_py3 import GalleryImageStatusProvisioningStatus -from ._models_py3 import GalleryImageVersion -from ._models_py3 import GalleryImageVersionStorageProfile -from ._models_py3 import GalleryOSDiskImage -from ._models_py3 import Galleryimages -from ._models_py3 import GalleryimagesListResult -from ._models_py3 import GalleryimagesPatch -from ._models_py3 import GuestAgent -from ._models_py3 import GuestAgentList -from ._models_py3 import GuestAgentProfile -from ._models_py3 import GuestCredential -from ._models_py3 import HardwareProfileUpdate -from ._models_py3 import HttpProxyConfiguration -from ._models_py3 import HybridIdentityMetadata -from ._models_py3 import HybridIdentityMetadataList -from ._models_py3 import IPPool -from ._models_py3 import IPPoolInfo -from ._models_py3 import Identity -from ._models_py3 import InterfaceDNSSettings -from ._models_py3 import IpConfiguration -from ._models_py3 import IpConfigurationProperties -from ._models_py3 import IpConfigurationPropertiesSubnet -from ._models_py3 import MachineExtension -from ._models_py3 import MachineExtensionInstanceView -from ._models_py3 import MachineExtensionInstanceViewStatus -from ._models_py3 import MachineExtensionPropertiesInstanceView -from ._models_py3 import MachineExtensionUpdate -from ._models_py3 import MachineExtensionsListResult -from ._models_py3 import MarketplaceGalleryImageStatus -from ._models_py3 import MarketplaceGalleryImageStatusDownloadStatus -from ._models_py3 import MarketplaceGalleryImageStatusProvisioningStatus -from ._models_py3 import Marketplacegalleryimages -from ._models_py3 import MarketplacegalleryimagesListResult -from ._models_py3 import MarketplacegalleryimagesPatch -from ._models_py3 import NetworkInterfaceStatus -from ._models_py3 import NetworkInterfaceStatusProvisioningStatus -from ._models_py3 import NetworkProfileUpdate -from ._models_py3 import NetworkProfileUpdateNetworkInterfacesItem -from ._models_py3 import Networkinterfaces -from ._models_py3 import NetworkinterfacesListResult -from ._models_py3 import NetworkinterfacesPatch +from ._models_py3 import ExtensionUpgradeParameters +from ._models_py3 import Offer +from ._models_py3 import OfferList from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import PackageVersionInfo +from ._models_py3 import PasswordCredential from ._models_py3 import PerNodeExtensionState from ._models_py3 import PerNodeState +from ._models_py3 import PrecheckResult +from ._models_py3 import PrecheckResultTags from ._models_py3 import ProxyResource +from ._models_py3 import Publisher +from ._models_py3 import PublisherList +from ._models_py3 import RawCertificateData from ._models_py3 import Resource -from ._models_py3 import ResourcePatch -from ._models_py3 import StorageContainerStatus -from ._models_py3 import StorageContainerStatusProvisioningStatus -from ._models_py3 import StorageProfileUpdate -from ._models_py3 import StorageProfileUpdateDataDisksItem -from ._models_py3 import Storagecontainers -from ._models_py3 import StoragecontainersExtendedLocation -from ._models_py3 import StoragecontainersListResult -from ._models_py3 import StoragecontainersPatch +from ._models_py3 import Sku +from ._models_py3 import SkuList +from ._models_py3 import SkuMappings +from ._models_py3 import SoftwareAssuranceChangeRequest +from ._models_py3 import SoftwareAssuranceChangeRequestProperties +from ._models_py3 import SoftwareAssuranceProperties +from ._models_py3 import Step from ._models_py3 import SystemData from ._models_py3 import TrackedResource -from ._models_py3 import VirtualHardDiskStatus -from ._models_py3 import VirtualHardDiskStatusProvisioningStatus -from ._models_py3 import VirtualMachineStatus -from ._models_py3 import VirtualMachineStatusProvisioningStatus -from ._models_py3 import VirtualMachineUpdateProperties -from ._models_py3 import VirtualNetworkStatus -from ._models_py3 import VirtualNetworkStatusProvisioningStatus -from ._models_py3 import Virtualharddisks -from ._models_py3 import VirtualharddisksListResult -from ._models_py3 import VirtualharddisksPatch -from ._models_py3 import Virtualmachines -from ._models_py3 import VirtualmachinesListResult -from ._models_py3 import VirtualmachinesPatch -from ._models_py3 import VirtualmachinesPropertiesHardwareProfile -from ._models_py3 import VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig -from ._models_py3 import VirtualmachinesPropertiesNetworkProfile -from ._models_py3 import VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem -from ._models_py3 import VirtualmachinesPropertiesOsProfile -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfiguration -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh -from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfiguration -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh -from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem -from ._models_py3 import VirtualmachinesPropertiesSecurityProfile -from ._models_py3 import VirtualmachinesPropertiesSecurityProfileUefiSettings -from ._models_py3 import VirtualmachinesPropertiesStorageProfile -from ._models_py3 import VirtualmachinesPropertiesStorageProfileDataDisksItem -from ._models_py3 import VirtualmachinesPropertiesStorageProfileImageReference -from ._models_py3 import VirtualmachinesPropertiesStorageProfileOsDisk -from ._models_py3 import Virtualnetworks -from ._models_py3 import VirtualnetworksListResult -from ._models_py3 import VirtualnetworksPatch -from ._models_py3 import VirtualnetworksPropertiesSubnetsItem -from ._models_py3 import VirtualnetworksPropertiesSubnetsPropertiesItemsItem +from ._models_py3 import Update +from ._models_py3 import UpdateList +from ._models_py3 import UpdatePrerequisite +from ._models_py3 import UpdateRun +from ._models_py3 import UpdateRunList +from ._models_py3 import UpdateSummaries +from ._models_py3 import UpdateSummariesList +from ._models_py3 import UploadCertificateRequest +from ._models_py3 import UserAssignedIdentity from ._azure_stack_hci_client_enums import ActionType from ._azure_stack_hci_client_enums import ArcSettingAggregateState -from ._azure_stack_hci_client_enums import CloudInitDataSource +from ._azure_stack_hci_client_enums import AvailabilityType +from ._azure_stack_hci_client_enums import ClusterNodeType from ._azure_stack_hci_client_enums import CreatedByType from ._azure_stack_hci_client_enums import DiagnosticLevel -from ._azure_stack_hci_client_enums import DiskFileFormat -from ._azure_stack_hci_client_enums import ExtendedLocationTypes from ._azure_stack_hci_client_enums import ExtensionAggregateState -from ._azure_stack_hci_client_enums import HyperVGeneration -from ._azure_stack_hci_client_enums import IPPoolTypeEnum +from ._azure_stack_hci_client_enums import ExtensionManagedBy +from ._azure_stack_hci_client_enums import HealthState from ._azure_stack_hci_client_enums import ImdsAttestation -from ._azure_stack_hci_client_enums import IpAllocationMethodEnum -from ._azure_stack_hci_client_enums import NetworkTypeEnum +from ._azure_stack_hci_client_enums import ManagedServiceIdentityType from ._azure_stack_hci_client_enums import NodeArcState from ._azure_stack_hci_client_enums import NodeExtensionState -from ._azure_stack_hci_client_enums import OperatingSystemTypes from ._azure_stack_hci_client_enums import Origin -from ._azure_stack_hci_client_enums import OsTypeEnum -from ._azure_stack_hci_client_enums import PowerStateEnum -from ._azure_stack_hci_client_enums import PrivateIPAllocationMethodEnum -from ._azure_stack_hci_client_enums import ProvisioningAction from ._azure_stack_hci_client_enums import ProvisioningState -from ._azure_stack_hci_client_enums import ProvisioningStateEnum -from ._azure_stack_hci_client_enums import ProvisioningStatusEnum +from ._azure_stack_hci_client_enums import RebootRequirement +from ._azure_stack_hci_client_enums import Severity +from ._azure_stack_hci_client_enums import SoftwareAssuranceIntent +from ._azure_stack_hci_client_enums import SoftwareAssuranceStatus +from ._azure_stack_hci_client_enums import State from ._azure_stack_hci_client_enums import Status from ._azure_stack_hci_client_enums import StatusLevelTypes -from ._azure_stack_hci_client_enums import StatusTypes -from ._azure_stack_hci_client_enums import VmSizeEnum +from ._azure_stack_hci_client_enums import UpdateRunPropertiesState +from ._azure_stack_hci_client_enums import UpdateSummariesPropertiesState from ._azure_stack_hci_client_enums import WindowsServerSubscription from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ArcConnectivityProperties", + "ArcIdentityResponse", "ArcSetting", "ArcSettingList", + "ArcSettingsPatch", "Cluster", "ClusterDesiredProperties", + "ClusterIdentityResponse", "ClusterList", "ClusterNode", "ClusterPatch", "ClusterReportedProperties", - "ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable", - "ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems", + "DefaultExtensionDetails", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", - "ExtendedLocation", "Extension", + "ExtensionInstanceView", + "ExtensionInstanceViewStatus", "ExtensionList", - "GalleryDiskImage", - "GalleryImageIdentifier", - "GalleryImageStatus", - "GalleryImageStatusDownloadStatus", - "GalleryImageStatusProvisioningStatus", - "GalleryImageVersion", - "GalleryImageVersionStorageProfile", - "GalleryOSDiskImage", - "Galleryimages", - "GalleryimagesListResult", - "GalleryimagesPatch", - "GuestAgent", - "GuestAgentList", - "GuestAgentProfile", - "GuestCredential", - "HardwareProfileUpdate", - "HttpProxyConfiguration", - "HybridIdentityMetadata", - "HybridIdentityMetadataList", - "IPPool", - "IPPoolInfo", - "Identity", - "InterfaceDNSSettings", - "IpConfiguration", - "IpConfigurationProperties", - "IpConfigurationPropertiesSubnet", - "MachineExtension", - "MachineExtensionInstanceView", - "MachineExtensionInstanceViewStatus", - "MachineExtensionPropertiesInstanceView", - "MachineExtensionUpdate", - "MachineExtensionsListResult", - "MarketplaceGalleryImageStatus", - "MarketplaceGalleryImageStatusDownloadStatus", - "MarketplaceGalleryImageStatusProvisioningStatus", - "Marketplacegalleryimages", - "MarketplacegalleryimagesListResult", - "MarketplacegalleryimagesPatch", - "NetworkInterfaceStatus", - "NetworkInterfaceStatusProvisioningStatus", - "NetworkProfileUpdate", - "NetworkProfileUpdateNetworkInterfacesItem", - "Networkinterfaces", - "NetworkinterfacesListResult", - "NetworkinterfacesPatch", + "ExtensionUpgradeParameters", + "Offer", + "OfferList", "Operation", "OperationDisplay", "OperationListResult", + "PackageVersionInfo", + "PasswordCredential", "PerNodeExtensionState", "PerNodeState", + "PrecheckResult", + "PrecheckResultTags", "ProxyResource", + "Publisher", + "PublisherList", + "RawCertificateData", "Resource", - "ResourcePatch", - "StorageContainerStatus", - "StorageContainerStatusProvisioningStatus", - "StorageProfileUpdate", - "StorageProfileUpdateDataDisksItem", - "Storagecontainers", - "StoragecontainersExtendedLocation", - "StoragecontainersListResult", - "StoragecontainersPatch", + "Sku", + "SkuList", + "SkuMappings", + "SoftwareAssuranceChangeRequest", + "SoftwareAssuranceChangeRequestProperties", + "SoftwareAssuranceProperties", + "Step", "SystemData", "TrackedResource", - "VirtualHardDiskStatus", - "VirtualHardDiskStatusProvisioningStatus", - "VirtualMachineStatus", - "VirtualMachineStatusProvisioningStatus", - "VirtualMachineUpdateProperties", - "VirtualNetworkStatus", - "VirtualNetworkStatusProvisioningStatus", - "Virtualharddisks", - "VirtualharddisksListResult", - "VirtualharddisksPatch", - "Virtualmachines", - "VirtualmachinesListResult", - "VirtualmachinesPatch", - "VirtualmachinesPropertiesHardwareProfile", - "VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig", - "VirtualmachinesPropertiesNetworkProfile", - "VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem", - "VirtualmachinesPropertiesOsProfile", - "VirtualmachinesPropertiesOsProfileLinuxConfiguration", - "VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh", - "VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem", - "VirtualmachinesPropertiesOsProfileWindowsConfiguration", - "VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh", - "VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem", - "VirtualmachinesPropertiesSecurityProfile", - "VirtualmachinesPropertiesSecurityProfileUefiSettings", - "VirtualmachinesPropertiesStorageProfile", - "VirtualmachinesPropertiesStorageProfileDataDisksItem", - "VirtualmachinesPropertiesStorageProfileImageReference", - "VirtualmachinesPropertiesStorageProfileOsDisk", - "Virtualnetworks", - "VirtualnetworksListResult", - "VirtualnetworksPatch", - "VirtualnetworksPropertiesSubnetsItem", - "VirtualnetworksPropertiesSubnetsPropertiesItemsItem", + "Update", + "UpdateList", + "UpdatePrerequisite", + "UpdateRun", + "UpdateRunList", + "UpdateSummaries", + "UpdateSummariesList", + "UploadCertificateRequest", + "UserAssignedIdentity", "ActionType", "ArcSettingAggregateState", - "CloudInitDataSource", + "AvailabilityType", + "ClusterNodeType", "CreatedByType", "DiagnosticLevel", - "DiskFileFormat", - "ExtendedLocationTypes", "ExtensionAggregateState", - "HyperVGeneration", - "IPPoolTypeEnum", + "ExtensionManagedBy", + "HealthState", "ImdsAttestation", - "IpAllocationMethodEnum", - "NetworkTypeEnum", + "ManagedServiceIdentityType", "NodeArcState", "NodeExtensionState", - "OperatingSystemTypes", "Origin", - "OsTypeEnum", - "PowerStateEnum", - "PrivateIPAllocationMethodEnum", - "ProvisioningAction", "ProvisioningState", - "ProvisioningStateEnum", - "ProvisioningStatusEnum", + "RebootRequirement", + "Severity", + "SoftwareAssuranceIntent", + "SoftwareAssuranceStatus", + "State", "Status", "StatusLevelTypes", - "StatusTypes", - "VmSizeEnum", + "UpdateRunPropertiesState", + "UpdateSummariesPropertiesState", "WindowsServerSubscription", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py index ecbb163067c1..3e38a9b26126 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py @@ -34,13 +34,24 @@ class ArcSettingAggregateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARTIALLY_SUCCEEDED = "PartiallySucceeded" PARTIALLY_CONNECTED = "PartiallyConnected" IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + DISABLE_IN_PROGRESS = "DisableInProgress" -class CloudInitDataSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Datasource for the gallery image when provisioning with cloud-init (Azure or NoCloud).""" +class AvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the way the update content can be downloaded.""" + + LOCAL = "Local" + ONLINE = "Online" + NOTIFY = "Notify" - NO_CLOUD = "NoCloud" - AZURE = "Azure" + +class ClusterNodeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The node type of all the nodes of the cluster.""" + + FIRST_PARTY = "FirstParty" + THIRD_PARTY = "ThirdParty" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -60,19 +71,6 @@ class DiagnosticLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENHANCED = "Enhanced" -class DiskFileFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The format of the actual VHD file [vhd, vhdx].""" - - VHDX = "vhdx" - VHD = "vhd" - - -class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation.""" - - CUSTOM_LOCATION = "CustomLocation" - - class ExtensionAggregateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Aggregate state of Arc Extensions across the nodes in this HCI cluster.""" @@ -91,13 +89,27 @@ class ExtensionAggregateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARTIALLY_SUCCEEDED = "PartiallySucceeded" PARTIALLY_CONNECTED = "PartiallyConnected" IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + UPGRADE_FAILED_ROLLBACK_SUCCEEDED = "UpgradeFailedRollbackSucceeded" + + +class ExtensionManagedBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if the extension is managed by azure or the user.""" + + AZURE = "Azure" + USER = "User" -class HyperVGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The hypervisor generation of the Virtual Machine [V1, V2].""" +class HealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HealthState.""" - V1 = "V1" - V2 = "V2" + UNKNOWN = "Unknown" + SUCCESS = "Success" + FAILURE = "Failure" + WARNING = "Warning" + ERROR = "Error" + IN_PROGRESS = "InProgress" class ImdsAttestation(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -107,34 +119,15 @@ class ImdsAttestation(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" -class IpAllocationMethodEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', - 'Dynamic'. +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). """ - DYNAMIC = "Dynamic" - STATIC = "Static" - - -class IPPoolTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ip pool type.""" - - VM = "vm" - VIPPOOL = "vippool" - - -class NetworkTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the network.""" - - NAT = "NAT" - TRANSPARENT = "Transparent" - L2_BRIDGE = "L2Bridge" - L2_TUNNEL = "L2Tunnel" - ICS = "ICS" - PRIVATE = "Private" - OVERLAY = "Overlay" - INTERNAL = "Internal" - MIRRORED = "Mirrored" + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" class NodeArcState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -152,6 +145,12 @@ class NodeArcState(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATING = "Updating" DELETING = "Deleting" MOVING = "Moving" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + PARTIALLY_CONNECTED = "PartiallyConnected" + IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + DISABLE_IN_PROGRESS = "DisableInProgress" class NodeExtensionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -169,13 +168,11 @@ class NodeExtensionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATING = "Updating" DELETING = "Deleting" MOVING = "Moving" - - -class OperatingSystemTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """operating system type that the gallery image uses. Expected to be linux or windows.""" - - WINDOWS = "Windows" - LINUX = "Linux" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + PARTIALLY_CONNECTED = "PartiallyConnected" + IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -188,69 +185,83 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class OsTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType - string specifying whether the OS is Linux or Windows.""" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the ArcSetting proxy resource.""" - LINUX = "Linux" - WINDOWS = "Windows" + NOT_SPECIFIED = "NotSpecified" + ERROR = "Error" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + DELETED = "Deleted" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + MOVING = "Moving" + PARTIALLY_SUCCEEDED = "PartiallySucceeded" + PARTIALLY_CONNECTED = "PartiallyConnected" + IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + DISABLE_IN_PROGRESS = "DisableInProgress" -class PowerStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The power state of the virtual machine.""" +class RebootRequirement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RebootRequirement.""" - DEALLOCATED = "Deallocated" - DEALLOCATING = "Deallocating" - RUNNING = "Running" - STARTING = "Starting" - STOPPED = "Stopped" - STOPPING = "Stopping" UNKNOWN = "Unknown" + TRUE = "True" + FALSE = "False" -class PrivateIPAllocationMethodEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: - 'Static', 'Dynamic'. +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of the result (Critical, Warning, Informational, Hidden). This answers how important + the result is. Critical is the only update-blocking severity. """ - DYNAMIC = "Dynamic" - STATIC = "Static" - - -class ProvisioningAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the different types of operations for guest agent.""" - - INSTALL = "install" - UNINSTALL = "uninstall" - REPAIR = "repair" + CRITICAL = "Critical" + WARNING = "Warning" + INFORMATIONAL = "Informational" + HIDDEN = "Hidden" -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the ArcSetting proxy resource.""" +class SoftwareAssuranceIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Customer Intent for Software Assurance Benefit.""" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - ACCEPTED = "Accepted" - PROVISIONING = "Provisioning" + ENABLE = "Enable" + DISABLE = "Disable" -class ProvisioningStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the gallery image.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - IN_PROGRESS = "InProgress" - ACCEPTED = "Accepted" - DELETING = "Deleting" - CANCELED = "Canceled" +class SoftwareAssuranceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the Software Assurance for the cluster.""" + ENABLED = "Enabled" + DISABLED = "Disabled" -class ProvisioningStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the operation performed on the gallery image [Succeeded, Failed, InProgress].""" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - IN_PROGRESS = "InProgress" +class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the update as it relates to this stamp.""" + + HAS_PREREQUISITE = "HasPrerequisite" + OBSOLETE = "Obsolete" + READY = "Ready" + NOT_APPLICABLE_BECAUSE_ANOTHER_UPDATE_IS_IN_PROGRESS = "NotApplicableBecauseAnotherUpdateIsInProgress" + PREPARING = "Preparing" + INSTALLING = "Installing" + INSTALLED = "Installed" + PREPARATION_FAILED = "PreparationFailed" + INSTALLATION_FAILED = "InstallationFailed" + INVALID = "Invalid" + RECALLED = "Recalled" + DOWNLOADING = "Downloading" + DOWNLOAD_FAILED = "DownloadFailed" + HEALTH_CHECKING = "HealthChecking" + HEALTH_CHECK_FAILED = "HealthCheckFailed" + READY_TO_INSTALL = "ReadyToInstall" + SCAN_IN_PROGRESS = "ScanInProgress" + SCAN_FAILED = "ScanFailed" class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -261,6 +272,10 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_CONNECTED_RECENTLY = "NotConnectedRecently" DISCONNECTED = "Disconnected" ERROR = "Error" + NOT_SPECIFIED = "NotSpecified" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + IN_PROGRESS = "InProgress" class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -271,40 +286,26 @@ class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): ERROR = "Error" -class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the hybrid machine agent.""" +class UpdateRunPropertiesState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the update run.""" + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + IN_PROGRESS = "InProgress" + FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - ERROR = "Error" +class UpdateSummariesPropertiesState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Overall update state of the stamp.""" -class VmSizeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VmSizeEnum.""" - - DEFAULT = "Default" - STANDARD_A2_V2 = "Standard_A2_v2" - STANDARD_A4_V2 = "Standard_A4_v2" - STANDARD_D2_S_V3 = "Standard_D2s_v3" - STANDARD_D4_S_V3 = "Standard_D4s_v3" - STANDARD_D8_S_V3 = "Standard_D8s_v3" - STANDARD_D16_S_V3 = "Standard_D16s_v3" - STANDARD_D32_S_V3 = "Standard_D32s_v3" - STANDARD_DS2_V2 = "Standard_DS2_v2" - STANDARD_DS3_V2 = "Standard_DS3_v2" - STANDARD_DS4_V2 = "Standard_DS4_v2" - STANDARD_DS5_V2 = "Standard_DS5_v2" - STANDARD_DS13_V2 = "Standard_DS13_v2" - STANDARD_K8_S_V1 = "Standard_K8S_v1" - STANDARD_K8_S2_V1 = "Standard_K8S2_v1" - STANDARD_K8_S3_V1 = "Standard_K8S3_v1" - STANDARD_K8_S4_V1 = "Standard_K8S4_v1" - STANDARD_NK6 = "Standard_NK6" - STANDARD_NK12 = "Standard_NK12" - STANDARD_NV6 = "Standard_NV6" - STANDARD_NV12 = "Standard_NV12" - STANDARD_K8_S5_V1 = "Standard_K8S5_v1" - CUSTOM = "Custom" + UNKNOWN = "Unknown" + APPLIED_SUCCESSFULLY = "AppliedSuccessfully" + UPDATE_AVAILABLE = "UpdateAvailable" + UPDATE_IN_PROGRESS = "UpdateInProgress" + UPDATE_FAILED = "UpdateFailed" + NEEDS_ATTENTION = "NeedsAttention" + PREPARATION_IN_PROGRESS = "PreparationInProgress" + PREPARATION_FAILED = "PreparationFailed" class WindowsServerSubscription(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py index 82ee46fb4e92..87ed0bb00741 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py @@ -17,10 +17,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -28,6 +24,72 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class ArcConnectivityProperties(_serialization.Model): + """Connectivity related configuration required by arc server. + + :ivar enabled: True indicates ARC connectivity is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: True indicates ARC connectivity is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ArcIdentityResponse(_serialization.Model): + """ArcIdentity details. + + :ivar arc_application_client_id: + :vartype arc_application_client_id: str + :ivar arc_application_tenant_id: + :vartype arc_application_tenant_id: str + :ivar arc_service_principal_object_id: + :vartype arc_service_principal_object_id: str + :ivar arc_application_object_id: + :vartype arc_application_object_id: str + """ + + _attribute_map = { + "arc_application_client_id": {"key": "properties.arcApplicationClientId", "type": "str"}, + "arc_application_tenant_id": {"key": "properties.arcApplicationTenantId", "type": "str"}, + "arc_service_principal_object_id": {"key": "properties.arcServicePrincipalObjectId", "type": "str"}, + "arc_application_object_id": {"key": "properties.arcApplicationObjectId", "type": "str"}, + } + + def __init__( + self, + *, + arc_application_client_id: Optional[str] = None, + arc_application_tenant_id: Optional[str] = None, + arc_service_principal_object_id: Optional[str] = None, + arc_application_object_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword arc_application_client_id: + :paramtype arc_application_client_id: str + :keyword arc_application_tenant_id: + :paramtype arc_application_tenant_id: str + :keyword arc_service_principal_object_id: + :paramtype arc_service_principal_object_id: str + :keyword arc_application_object_id: + :paramtype arc_application_object_id: str + """ + super().__init__(**kwargs) + self.arc_application_client_id = arc_application_client_id + self.arc_application_tenant_id = arc_application_tenant_id + self.arc_service_principal_object_id = arc_service_principal_object_id + self.arc_application_object_id = arc_application_object_id + + class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -41,30 +103,37 @@ class Resource(_serialization.Model): :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.azurestackhci.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """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. @@ -76,21 +145,26 @@ class ProxyResource(Resource): :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.azurestackhci.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -108,99 +182,104 @@ class ArcSetting(ProxyResource): # pylint: disable=too-many-instance-attributes :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.azurestackhci.models.SystemData :ivar provisioning_state: Provisioning state of the ArcSetting proxy resource. Known values - are: "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + are: "NotSpecified", "Error", "Succeeded", "Failed", "Canceled", "Connected", "Disconnected", + "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState :ivar arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. :vartype arc_instance_resource_group: str + :ivar arc_application_client_id: App id of arc AAD identity. + :vartype arc_application_client_id: str + :ivar arc_application_tenant_id: Tenant id of arc AAD identity. + :vartype arc_application_tenant_id: str + :ivar arc_service_principal_object_id: Object id of arc AAD service principal. + :vartype arc_service_principal_object_id: str + :ivar arc_application_object_id: Object id of arc AAD identity. + :vartype arc_application_object_id: str :ivar aggregate_state: Aggregate state of Arc agent across the nodes in this HCI cluster. Known values are: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", - "PartiallyConnected", and "InProgress". + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.models.ArcSettingAggregateState :ivar per_node_details: State of Arc agent in each of the nodes. :vartype per_node_details: list[~azure.mgmt.azurestackhci.models.PerNodeState] - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :ivar connectivity_properties: contains connectivity related configuration for ARC resources. + :vartype connectivity_properties: JSON + :ivar default_extensions: Properties for each of the default extensions category. + :vartype default_extensions: list[~azure.mgmt.azurestackhci.models.DefaultExtensionDetails] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, - "arc_instance_resource_group": {"readonly": True}, "aggregate_state": {"readonly": True}, "per_node_details": {"readonly": True}, + "default_extensions": {"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"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "arc_instance_resource_group": {"key": "properties.arcInstanceResourceGroup", "type": "str"}, + "arc_application_client_id": {"key": "properties.arcApplicationClientId", "type": "str"}, + "arc_application_tenant_id": {"key": "properties.arcApplicationTenantId", "type": "str"}, + "arc_service_principal_object_id": {"key": "properties.arcServicePrincipalObjectId", "type": "str"}, + "arc_application_object_id": {"key": "properties.arcApplicationObjectId", "type": "str"}, "aggregate_state": {"key": "properties.aggregateState", "type": "str"}, "per_node_details": {"key": "properties.perNodeDetails", "type": "[PerNodeState]"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, + "connectivity_properties": {"key": "properties.connectivityProperties", "type": "object"}, + "default_extensions": {"key": "properties.defaultExtensions", "type": "[DefaultExtensionDetails]"}, } 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 - ): - """ - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + arc_instance_resource_group: Optional[str] = None, + arc_application_client_id: Optional[str] = None, + arc_application_tenant_id: Optional[str] = None, + arc_service_principal_object_id: Optional[str] = None, + arc_application_object_id: Optional[str] = None, + connectivity_properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid + Compute Machine resources. + :paramtype arc_instance_resource_group: str + :keyword arc_application_client_id: App id of arc AAD identity. + :paramtype arc_application_client_id: str + :keyword arc_application_tenant_id: Tenant id of arc AAD identity. + :paramtype arc_application_tenant_id: str + :keyword arc_service_principal_object_id: Object id of arc AAD service principal. + :paramtype arc_service_principal_object_id: str + :keyword arc_application_object_id: Object id of arc AAD identity. + :paramtype arc_application_object_id: str + :keyword connectivity_properties: contains connectivity related configuration for ARC + resources. + :paramtype connectivity_properties: JSON """ super().__init__(**kwargs) self.provisioning_state = None - self.arc_instance_resource_group = None + self.arc_instance_resource_group = arc_instance_resource_group + self.arc_application_client_id = arc_application_client_id + self.arc_application_tenant_id = arc_application_tenant_id + self.arc_service_principal_object_id = arc_service_principal_object_id + self.arc_application_object_id = arc_application_object_id self.aggregate_state = None self.per_node_details = None - 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 + self.connectivity_properties = connectivity_properties + self.default_extensions = None class ArcSettingList(_serialization.Model): @@ -224,15 +303,45 @@ class ArcSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class ArcSettingsPatch(_serialization.Model): + """ArcSetting details to update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar connectivity_properties: contains connectivity related configuration for ARC resources. + :vartype connectivity_properties: JSON + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "connectivity_properties": {"key": "properties.connectivityProperties", "type": "object"}, + } + + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, connectivity_properties: Optional[JSON] = None, **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword connectivity_properties: contains connectivity related configuration for ARC + resources. + :paramtype connectivity_properties: JSON + """ + super().__init__(**kwargs) + self.tags = tags + self.connectivity_properties = connectivity_properties + + class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """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. @@ -246,6 +355,9 @@ class TrackedResource(Resource): :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.azurestackhci.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -256,6 +368,7 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -263,11 +376,12 @@ class TrackedResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -294,15 +408,21 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :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.azurestackhci.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 provisioning_state: Provisioning state. Known values are: "Succeeded", "Failed", - "Canceled", "Accepted", and "Provisioning". + :ivar provisioning_state: Provisioning state. Known values are: "NotSpecified", "Error", + "Succeeded", "Failed", "Canceled", "Connected", "Disconnected", "Deleted", "Creating", + "Updating", "Deleting", "Moving", "PartiallySucceeded", "PartiallyConnected", "InProgress", + "Accepted", "Provisioning", and "DisableInProgress". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState :ivar status: Status of the cluster agent. Known values are: "NotYetRegistered", - "ConnectedRecently", "NotConnectedRecently", "Disconnected", and "Error". + "ConnectedRecently", "NotConnectedRecently", "Disconnected", "Error", "NotSpecified", + "Succeeded", "Failed", and "InProgress". :vartype status: str or ~azure.mgmt.azurestackhci.models.Status :ivar cloud_id: Unique, immutable resource id. :vartype cloud_id: str @@ -312,6 +432,13 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype aad_client_id: str :ivar aad_tenant_id: Tenant id of cluster AAD identity. :vartype aad_tenant_id: str + :ivar aad_application_object_id: Object id of cluster AAD identity. + :vartype aad_application_object_id: str + :ivar aad_service_principal_object_id: Id of cluster identity service principal. + :vartype aad_service_principal_object_id: str + :ivar software_assurance_properties: Software Assurance properties of the cluster. + :vartype software_assurance_properties: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceProperties :ivar desired_properties: Desired properties of the cluster. :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties :ivar reported_properties: Properties reported by cluster agent. @@ -326,26 +453,33 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype last_sync_timestamp: ~datetime.datetime :ivar last_billing_timestamp: Most recent billing meter timestamp. :vartype last_billing_timestamp: ~datetime.datetime - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :ivar service_endpoint: Region specific DataPath Endpoint of the cluster. + :vartype service_endpoint: str + :ivar resource_provider_object_id: Object id of RP Service Principal. + :vartype resource_provider_object_id: str + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type_identity_type: Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + and "SystemAssigned, UserAssigned". + :vartype type_identity_type: str or ~azure.mgmt.azurestackhci.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.azurestackhci.models.UserAssignedIdentity] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, @@ -356,12 +490,17 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "registration_timestamp": {"readonly": True}, "last_sync_timestamp": {"readonly": True}, "last_billing_timestamp": {"readonly": True}, + "service_endpoint": {"readonly": True}, + "resource_provider_object_id": {"readonly": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"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"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -370,6 +509,12 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "cloud_management_endpoint": {"key": "properties.cloudManagementEndpoint", "type": "str"}, "aad_client_id": {"key": "properties.aadClientId", "type": "str"}, "aad_tenant_id": {"key": "properties.aadTenantId", "type": "str"}, + "aad_application_object_id": {"key": "properties.aadApplicationObjectId", "type": "str"}, + "aad_service_principal_object_id": {"key": "properties.aadServicePrincipalObjectId", "type": "str"}, + "software_assurance_properties": { + "key": "properties.softwareAssuranceProperties", + "type": "SoftwareAssuranceProperties", + }, "desired_properties": {"key": "properties.desiredProperties", "type": "ClusterDesiredProperties"}, "reported_properties": {"key": "properties.reportedProperties", "type": "ClusterReportedProperties"}, "trial_days_remaining": {"key": "properties.trialDaysRemaining", "type": "float"}, @@ -377,12 +522,12 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "registration_timestamp": {"key": "properties.registrationTimestamp", "type": "iso-8601"}, "last_sync_timestamp": {"key": "properties.lastSyncTimestamp", "type": "iso-8601"}, "last_billing_timestamp": {"key": "properties.lastBillingTimestamp", "type": "iso-8601"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, + "service_endpoint": {"key": "properties.serviceEndpoint", "type": "str"}, + "resource_provider_object_id": {"key": "properties.resourceProviderObjectId", "type": "str"}, + "principal_id": {"key": "identity.principalId", "type": "str"}, + "tenant_id": {"key": "identity.tenantId", "type": "str"}, + "type_identity_type": {"key": "identity.type", "type": "str"}, + "user_assigned_identities": {"key": "identity.userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( # pylint: disable=too-many-locals @@ -393,15 +538,14 @@ def __init__( # pylint: disable=too-many-locals cloud_management_endpoint: Optional[str] = None, aad_client_id: Optional[str] = None, aad_tenant_id: Optional[str] = None, + aad_application_object_id: Optional[str] = None, + aad_service_principal_object_id: Optional[str] = None, + software_assurance_properties: Optional["_models.SoftwareAssuranceProperties"] = None, desired_properties: Optional["_models.ClusterDesiredProperties"] = None, - 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 - ): + type_identity_type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -413,22 +557,26 @@ def __init__( # pylint: disable=too-many-locals :paramtype aad_client_id: str :keyword aad_tenant_id: Tenant id of cluster AAD identity. :paramtype aad_tenant_id: str + :keyword aad_application_object_id: Object id of cluster AAD identity. + :paramtype aad_application_object_id: str + :keyword aad_service_principal_object_id: Id of cluster identity service principal. + :paramtype aad_service_principal_object_id: str + :keyword software_assurance_properties: Software Assurance properties of the cluster. + :paramtype software_assurance_properties: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceProperties :keyword desired_properties: Desired properties of the cluster. :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + :keyword type_identity_type: Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + and "SystemAssigned, UserAssigned". + :paramtype type_identity_type: str or + ~azure.mgmt.azurestackhci.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.azurestackhci.models.UserAssignedIdentity] """ super().__init__(tags=tags, location=location, **kwargs) self.provisioning_state = None @@ -437,6 +585,9 @@ def __init__( # pylint: disable=too-many-locals self.cloud_management_endpoint = cloud_management_endpoint self.aad_client_id = aad_client_id self.aad_tenant_id = aad_tenant_id + self.aad_application_object_id = aad_application_object_id + self.aad_service_principal_object_id = aad_service_principal_object_id + self.software_assurance_properties = software_assurance_properties self.desired_properties = desired_properties self.reported_properties = None self.trial_days_remaining = None @@ -444,12 +595,12 @@ def __init__( # pylint: disable=too-many-locals self.registration_timestamp = None self.last_sync_timestamp = None self.last_billing_timestamp = None - 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 + self.service_endpoint = None + self.resource_provider_object_id = None + self.principal_id = None + self.tenant_id = None + self.type_identity_type = type_identity_type + self.user_assigned_identities = user_assigned_identities class ClusterDesiredProperties(_serialization.Model): @@ -474,8 +625,8 @@ def __init__( *, windows_server_subscription: Optional[Union[str, "_models.WindowsServerSubscription"]] = None, diagnostic_level: Optional[Union[str, "_models.DiagnosticLevel"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword windows_server_subscription: Desired state of Windows Server Subscription. Known values are: "Disabled" and "Enabled". @@ -490,6 +641,52 @@ def __init__( self.diagnostic_level = diagnostic_level +class ClusterIdentityResponse(_serialization.Model): + """Cluster Identity details. + + :ivar aad_client_id: + :vartype aad_client_id: str + :ivar aad_tenant_id: + :vartype aad_tenant_id: str + :ivar aad_service_principal_object_id: + :vartype aad_service_principal_object_id: str + :ivar aad_application_object_id: + :vartype aad_application_object_id: str + """ + + _attribute_map = { + "aad_client_id": {"key": "properties.aadClientId", "type": "str"}, + "aad_tenant_id": {"key": "properties.aadTenantId", "type": "str"}, + "aad_service_principal_object_id": {"key": "properties.aadServicePrincipalObjectId", "type": "str"}, + "aad_application_object_id": {"key": "properties.aadApplicationObjectId", "type": "str"}, + } + + def __init__( + self, + *, + aad_client_id: Optional[str] = None, + aad_tenant_id: Optional[str] = None, + aad_service_principal_object_id: Optional[str] = None, + aad_application_object_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword aad_client_id: + :paramtype aad_client_id: str + :keyword aad_tenant_id: + :paramtype aad_tenant_id: str + :keyword aad_service_principal_object_id: + :paramtype aad_service_principal_object_id: str + :keyword aad_application_object_id: + :paramtype aad_application_object_id: str + """ + super().__init__(**kwargs) + self.aad_client_id = aad_client_id + self.aad_tenant_id = aad_tenant_id + self.aad_service_principal_object_id = aad_service_principal_object_id + self.aad_application_object_id = aad_application_object_id + + class ClusterList(_serialization.Model): """List of clusters. @@ -510,7 +707,7 @@ class ClusterList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs: Any) -> None: """ :keyword value: List of clusters. :paramtype value: list[~azure.mgmt.azurestackhci.models.Cluster] @@ -520,7 +717,7 @@ def __init__(self, *, value: Optional[List["_models.Cluster"]] = None, **kwargs) self.next_link = None -class ClusterNode(_serialization.Model): +class ClusterNode(_serialization.Model): # pylint: disable=too-many-instance-attributes """Cluster node details. Variables are only populated by the server, and will be ignored when sending a request. @@ -533,6 +730,11 @@ class ClusterNode(_serialization.Model): "Disabled" and "Enabled". :vartype windows_server_subscription: str or ~azure.mgmt.azurestackhci.models.WindowsServerSubscription + :ivar node_type: Type of the cluster node hardware. Known values are: "FirstParty" and + "ThirdParty". + :vartype node_type: str or ~azure.mgmt.azurestackhci.models.ClusterNodeType + :ivar ehc_resource_id: Edge Hardware Center Resource Id. + :vartype ehc_resource_id: str :ivar manufacturer: Manufacturer of the cluster node hardware. :vartype manufacturer: str :ivar model: Model name of the cluster node hardware. @@ -541,58 +743,76 @@ class ClusterNode(_serialization.Model): :vartype os_name: str :ivar os_version: Version of the operating system running on the cluster node. :vartype os_version: str + :ivar os_display_version: Display version of the operating system running on the cluster node. + :vartype os_display_version: str :ivar serial_number: Immutable id of the cluster node. :vartype serial_number: str :ivar core_count: Number of physical cores on the cluster node. :vartype core_count: float :ivar memory_in_gi_b: Total available memory on the cluster node (in GiB). :vartype memory_in_gi_b: float + :ivar last_licensing_timestamp: Most recent licensing timestamp. + :vartype last_licensing_timestamp: ~datetime.datetime """ _validation = { "name": {"readonly": True}, "id": {"readonly": True}, "windows_server_subscription": {"readonly": True}, + "node_type": {"readonly": True}, + "ehc_resource_id": {"readonly": True}, "manufacturer": {"readonly": True}, "model": {"readonly": True}, "os_name": {"readonly": True}, "os_version": {"readonly": True}, + "os_display_version": {"readonly": True}, "serial_number": {"readonly": True}, "core_count": {"readonly": True}, "memory_in_gi_b": {"readonly": True}, + "last_licensing_timestamp": {"readonly": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "float"}, "windows_server_subscription": {"key": "windowsServerSubscription", "type": "str"}, + "node_type": {"key": "nodeType", "type": "str"}, + "ehc_resource_id": {"key": "ehcResourceId", "type": "str"}, "manufacturer": {"key": "manufacturer", "type": "str"}, "model": {"key": "model", "type": "str"}, "os_name": {"key": "osName", "type": "str"}, "os_version": {"key": "osVersion", "type": "str"}, + "os_display_version": {"key": "osDisplayVersion", "type": "str"}, "serial_number": {"key": "serialNumber", "type": "str"}, "core_count": {"key": "coreCount", "type": "float"}, "memory_in_gi_b": {"key": "memoryInGiB", "type": "float"}, + "last_licensing_timestamp": {"key": "lastLicensingTimestamp", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None self.id = None self.windows_server_subscription = None + self.node_type = None + self.ehc_resource_id = None self.manufacturer = None self.model = None self.os_name = None self.os_version = None + self.os_display_version = None self.serial_number = None self.core_count = None self.memory_in_gi_b = None + self.last_licensing_timestamp = None class ClusterPatch(_serialization.Model): """Cluster details to update. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. @@ -603,14 +823,39 @@ class ClusterPatch(_serialization.Model): :vartype aad_tenant_id: str :ivar desired_properties: Desired properties of the cluster. :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, + UserAssigned". + :vartype type: str or ~azure.mgmt.azurestackhci.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.azurestackhci.models.UserAssignedIdentity] """ + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, "cloud_management_endpoint": {"key": "properties.cloudManagementEndpoint", "type": "str"}, "aad_client_id": {"key": "properties.aadClientId", "type": "str"}, "aad_tenant_id": {"key": "properties.aadTenantId", "type": "str"}, "desired_properties": {"key": "properties.desiredProperties", "type": "ClusterDesiredProperties"}, + "principal_id": {"key": "identity.principalId", "type": "str"}, + "tenant_id": {"key": "identity.tenantId", "type": "str"}, + "type": {"key": "identity.type", "type": "str"}, + "user_assigned_identities": {"key": "identity.userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( @@ -621,8 +866,10 @@ def __init__( aad_client_id: Optional[str] = None, aad_tenant_id: Optional[str] = None, desired_properties: Optional["_models.ClusterDesiredProperties"] = None, - **kwargs - ): + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -634,6 +881,16 @@ def __init__( :paramtype aad_tenant_id: str :keyword desired_properties: Desired properties of the cluster. :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned, UserAssigned". + :paramtype type: str or ~azure.mgmt.azurestackhci.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.azurestackhci.models.UserAssignedIdentity] """ super().__init__(**kwargs) self.tags = tags @@ -641,6 +898,10 @@ def __init__( self.aad_client_id = aad_client_id self.aad_tenant_id = aad_tenant_id self.desired_properties = desired_properties + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities class ClusterReportedProperties(_serialization.Model): @@ -664,6 +925,13 @@ class ClusterReportedProperties(_serialization.Model): :ivar diagnostic_level: Level of diagnostic data emitted by the cluster. Known values are: "Off", "Basic", and "Enhanced". :vartype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel + :ivar supported_capabilities: Capabilities supported by the cluster. + :vartype supported_capabilities: list[str] + :ivar cluster_type: The node type of all the nodes of the cluster. Known values are: + "FirstParty" and "ThirdParty". + :vartype cluster_type: str or ~azure.mgmt.azurestackhci.models.ClusterNodeType + :ivar manufacturer: The manufacturer of all the nodes of the cluster. + :vartype manufacturer: str """ _validation = { @@ -673,6 +941,9 @@ class ClusterReportedProperties(_serialization.Model): "nodes": {"readonly": True}, "last_updated": {"readonly": True}, "imds_attestation": {"readonly": True}, + "supported_capabilities": {"readonly": True}, + "cluster_type": {"readonly": True}, + "manufacturer": {"readonly": True}, } _attribute_map = { @@ -683,9 +954,14 @@ class ClusterReportedProperties(_serialization.Model): "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, "imds_attestation": {"key": "imdsAttestation", "type": "str"}, "diagnostic_level": {"key": "diagnosticLevel", "type": "str"}, + "supported_capabilities": {"key": "supportedCapabilities", "type": "[str]"}, + "cluster_type": {"key": "clusterType", "type": "str"}, + "manufacturer": {"key": "manufacturer", "type": "str"}, } - def __init__(self, *, diagnostic_level: Optional[Union[str, "_models.DiagnosticLevel"]] = None, **kwargs): + def __init__( + self, *, diagnostic_level: Optional[Union[str, "_models.DiagnosticLevel"]] = None, **kwargs: Any + ) -> None: """ :keyword diagnostic_level: Level of diagnostic data emitted by the cluster. Known values are: "Off", "Basic", and "Enhanced". @@ -699,77 +975,37 @@ def __init__(self, *, diagnostic_level: Optional[Union[str, "_models.DiagnosticL self.last_updated = None self.imds_attestation = None self.diagnostic_level = diagnostic_level + self.supported_capabilities = None + self.cluster_type = None + self.manufacturer = None -class ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable(_serialization.Model): - """RouteTable for the subnet. +class DefaultExtensionDetails(_serialization.Model): + """Properties for a particular default extension category. - :ivar id: Etag - Gets a unique read-only string that changes whenever the resource is updated. - :vartype id: str - :ivar name: Name - READ-ONLY; Resource name. - :vartype name: str - :ivar type: Type - READ-ONLY; Resource type. - :vartype type: str - :ivar routes: Routes - Collection of routes contained within a route table. - :vartype routes: - list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar category: Default extension category. + :vartype category: str + :ivar consent_time: Consent time for extension category. + :vartype consent_time: ~datetime.datetime """ - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "routes": {"key": "properties.routes", "type": "[VirtualnetworksPropertiesSubnetsPropertiesItemsItem]"}, + _validation = { + "category": {"readonly": True}, + "consent_time": {"readonly": True}, } - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - routes: Optional[List["_models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem"]] = None, - **kwargs - ): - """ - :keyword id: Etag - Gets a unique read-only string that changes whenever the resource is - updated. - :paramtype id: str - :keyword name: Name - READ-ONLY; Resource name. - :paramtype name: str - :keyword type: Type - READ-ONLY; Resource type. - :paramtype type: str - :keyword routes: Routes - Collection of routes contained within a route table. - :paramtype routes: - list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.routes = routes - - -class ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems( - _serialization.Model -): - """IPConfigurationReference - Describes a IPConfiguration under the virtual network. - - :ivar id: IPConfigurationID. - :vartype id: str - """ - _attribute_map = { - "id": {"key": "ID", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "consent_time": {"key": "consentTime", "type": "iso-8601"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: IPConfigurationID. - :paramtype id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.id = id + self.category = None + self.consent_time = None class ErrorAdditionalInfo(_serialization.Model): @@ -793,7 +1029,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -833,7 +1069,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -844,7 +1080,8 @@ def __init__(self, **kwargs): 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.). + """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.azurestackhci.models.ErrorDetail @@ -854,7 +1091,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.azurestackhci.models.ErrorDetail @@ -863,38 +1100,6 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): self.error = error -class ExtendedLocation(_serialization.Model): - """The complex type of the extended location. - - :ivar name: The name of the extended location. - :vartype name: str - :ivar type: The type of the extended location. "CustomLocation" - :vartype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, - **kwargs - ): - """ - :keyword name: The name of the extended location. - :paramtype name: str - :keyword type: The type of the extended location. "CustomLocation" - :paramtype type: str or ~azure.mgmt.azurestackhci.models.ExtendedLocationTypes - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes """Details of a particular extension in HCI Cluster. @@ -908,17 +1113,26 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes :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.azurestackhci.models.SystemData :ivar provisioning_state: Provisioning state of the Extension proxy resource. Known values are: - "Succeeded", "Failed", "Canceled", "Accepted", and "Provisioning". + "NotSpecified", "Error", "Succeeded", "Failed", "Canceled", "Connected", "Disconnected", + "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState :ivar aggregate_state: Aggregate state of Arc Extensions across the nodes in this HCI cluster. Known values are: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", - "PartiallyConnected", and "InProgress". + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and + "UpgradeFailedRollbackSucceeded". :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.models.ExtensionAggregateState :ivar per_node_extension_details: State of Arc Extension in each of the nodes. :vartype per_node_extension_details: list[~azure.mgmt.azurestackhci.models.PerNodeExtensionState] + :ivar managed_by: Indicates if the extension is managed by azure or the user. Known values are: + "Azure" and "User". + :vartype managed_by: str or ~azure.mgmt.azurestackhci.models.ExtensionManagedBy :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -927,7 +1141,8 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar type_properties_extension_parameters_type: Specifies the type of the extension; an example is "CustomScriptExtension". :vartype type_properties_extension_parameters_type: str - :ivar type_handler_version: Specifies the version of the script handler. + :ivar type_handler_version: Specifies the version of the script handler. Latest version would + be used if not specified. :vartype type_handler_version: str :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not @@ -937,38 +1152,31 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype settings: JSON :ivar protected_settings: Protected settings (may contain secrets). :vartype protected_settings: JSON - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "aggregate_state": {"readonly": True}, "per_node_extension_details": {"readonly": True}, + "managed_by": {"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"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "aggregate_state": {"key": "properties.aggregateState", "type": "str"}, "per_node_extension_details": {"key": "properties.perNodeExtensionDetails", "type": "[PerNodeExtensionState]"}, + "managed_by": {"key": "properties.managedBy", "type": "str"}, "force_update_tag": {"key": "properties.extensionParameters.forceUpdateTag", "type": "str"}, "publisher": {"key": "properties.extensionParameters.publisher", "type": "str"}, "type_properties_extension_parameters_type": {"key": "properties.extensionParameters.type", "type": "str"}, @@ -976,12 +1184,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes "auto_upgrade_minor_version": {"key": "properties.extensionParameters.autoUpgradeMinorVersion", "type": "bool"}, "settings": {"key": "properties.extensionParameters.settings", "type": "object"}, "protected_settings": {"key": "properties.extensionParameters.protectedSettings", "type": "object"}, - "created_by": {"key": "systemData.createdBy", "type": "str"}, - "created_by_type": {"key": "systemData.createdByType", "type": "str"}, - "created_at": {"key": "systemData.createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "systemData.lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "systemData.lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "systemData.lastModifiedAt", "type": "iso-8601"}, + "enable_automatic_upgrade": {"key": "properties.extensionParameters.enableAutomaticUpgrade", "type": "bool"}, } def __init__( @@ -994,14 +1197,9 @@ def __init__( auto_upgrade_minor_version: Optional[bool] = None, settings: Optional[JSON] = None, protected_settings: Optional[JSON] = None, - 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 - ): + enable_automatic_upgrade: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. @@ -1011,7 +1209,8 @@ def __init__( :keyword type_properties_extension_parameters_type: Specifies the type of the extension; an example is "CustomScriptExtension". :paramtype type_properties_extension_parameters_type: str - :keyword type_handler_version: Specifies the version of the script handler. + :keyword type_handler_version: Specifies the version of the script handler. Latest version + would be used if not specified. :paramtype type_handler_version: str :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not @@ -1021,25 +1220,15 @@ def __init__( :paramtype settings: JSON :keyword protected_settings: Protected settings (may contain secrets). :paramtype protected_settings: JSON - :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.azurestackhci.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.azurestackhci.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :paramtype enable_automatic_upgrade: bool """ super().__init__(**kwargs) self.provisioning_state = None self.aggregate_state = None self.per_node_extension_details = None + self.managed_by = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_extension_parameters_type = type_properties_extension_parameters_type @@ -1047,12 +1236,106 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - 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 + self.enable_automatic_upgrade = enable_automatic_upgrade + + +class ExtensionInstanceView(_serialization.Model): + """Describes the Extension Instance View. + + :ivar name: The extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: Instance view status. + :vartype status: ~azure.mgmt.azurestackhci.models.ExtensionInstanceViewStatus + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, + "status": {"key": "status", "type": "ExtensionInstanceViewStatus"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + status: Optional["_models.ExtensionInstanceViewStatus"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The extension name. + :paramtype name: str + :keyword type: Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword status: Instance view status. + :paramtype status: ~azure.mgmt.azurestackhci.models.ExtensionInstanceViewStatus + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.type_handler_version = type_handler_version + self.status = status + + +class ExtensionInstanceViewStatus(_serialization.Model): + """Instance view status. + + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.azurestackhci.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "time": {"key": "time", "type": "iso-8601"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: The status code. + :paramtype code: str + :keyword level: The level code. Known values are: "Info", "Warning", and "Error". + :paramtype level: str or ~azure.mgmt.azurestackhci.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.code = code + self.level = level + self.display_status = display_status + self.message = message + self.time = time class ExtensionList(_serialization.Model): @@ -1076,83 +1359,38 @@ class ExtensionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None -class GalleryDiskImage(_serialization.Model): - """This is the disk image base class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_mb: This property indicates the size of the VHD to be created. - :vartype size_in_mb: int - """ - - _validation = { - "size_in_mb": {"readonly": True}, - } - - _attribute_map = { - "size_in_mb": {"key": "sizeInMB", "type": "int"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.size_in_mb = None - - -class GalleryImageIdentifier(_serialization.Model): - """This is the gallery image definition identifier. - - All required parameters must be populated in order to send to Azure. +class ExtensionUpgradeParameters(_serialization.Model): + """Describes the parameters for Extension upgrade. - :ivar publisher: The name of the gallery image definition publisher. Required. - :vartype publisher: str - :ivar offer: The name of the gallery image definition offer. Required. - :vartype offer: str - :ivar sku: The name of the gallery image definition SKU. Required. - :vartype sku: str + :ivar target_version: Extension Upgrade Target Version. + :vartype target_version: str """ - _validation = { - "publisher": {"required": True}, - "offer": {"required": True}, - "sku": {"required": True}, - } - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, + "target_version": {"key": "targetVersion", "type": "str"}, } - def __init__(self, *, publisher: str, offer: str, sku: str, **kwargs): + def __init__(self, *, target_version: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword publisher: The name of the gallery image definition publisher. Required. - :paramtype publisher: str - :keyword offer: The name of the gallery image definition offer. Required. - :paramtype offer: str - :keyword sku: The name of the gallery image definition SKU. Required. - :paramtype sku: str + :keyword target_version: Extension Upgrade Target Version. + :paramtype target_version: str """ super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku + self.target_version = target_version -class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attributes - """The gallery image resource definition. +class Offer(ProxyResource): + """Offer 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 Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -1161,611 +1399,623 @@ class Galleryimages(TrackedResource): # pylint: disable=too-many-instance-attri :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 extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar container_name: Container Name for storage container. - :vartype container_name: str - :ivar image_path: location of the image the gallery image should be created from. - :vartype image_path: str - :ivar os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes - :ivar cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init (Azure or NoCloud). Known values are: "NoCloud" and "Azure". - :vartype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :ivar identifier: This is the gallery image definition identifier. - :vartype identifier: ~azure.mgmt.azurestackhci.models.GalleryImageIdentifier - :ivar version: Specifies information about the gallery image version that you want to create or - update. - :vartype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: GalleryImageStatus defines the observed state of galleryimages. - :vartype status: ~azure.mgmt.azurestackhci.models.GalleryImageStatus + :ivar provisioning_state: Provisioning State. + :vartype provisioning_state: str + :ivar publisher_id: Identifier of the Publisher for the offer. + :vartype publisher_id: str + :ivar content: JSON serialized catalog content of the offer. + :vartype content: str + :ivar content_version: The API version of the catalog service used to serve the catalog + content. + :vartype content_version: str + :ivar sku_mappings: Array of SKU mappings. + :vartype sku_mappings: list[~azure.mgmt.azurestackhci.models.SkuMappings] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, - "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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "container_name": {"key": "properties.containerName", "type": "str"}, - "image_path": {"key": "properties.imagePath", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "cloud_init_data_source": {"key": "properties.cloudInitDataSource", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, - "version": {"key": "properties.version", "type": "GalleryImageVersion"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "GalleryImageStatus"}, + "publisher_id": {"key": "properties.publisherId", "type": "str"}, + "content": {"key": "properties.content", "type": "str"}, + "content_version": {"key": "properties.contentVersion", "type": "str"}, + "sku_mappings": {"key": "properties.skuMappings", "type": "[SkuMappings]"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - container_name: Optional[str] = None, - image_path: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - cloud_init_data_source: Optional[Union[str, "_models.CloudInitDataSource"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - identifier: Optional["_models.GalleryImageIdentifier"] = None, - version: Optional["_models.GalleryImageVersion"] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword container_name: Container Name for storage container. - :paramtype container_name: str - :keyword image_path: location of the image the gallery image should be created from. - :paramtype image_path: str - :keyword os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes - :keyword cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init (Azure or NoCloud). Known values are: "NoCloud" and "Azure". - :paramtype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :keyword identifier: This is the gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.azurestackhci.models.GalleryImageIdentifier - :keyword version: Specifies information about the gallery image version that you want to create - or update. - :paramtype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str + publisher_id: Optional[str] = None, + content: Optional[str] = None, + content_version: Optional[str] = None, + sku_mappings: Optional[List["_models.SkuMappings"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_id: Identifier of the Publisher for the offer. + :paramtype publisher_id: str + :keyword content: JSON serialized catalog content of the offer. + :paramtype content: str + :keyword content_version: The API version of the catalog service used to serve the catalog + content. + :paramtype content_version: str + :keyword sku_mappings: Array of SKU mappings. + :paramtype sku_mappings: list[~azure.mgmt.azurestackhci.models.SkuMappings] """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.container_name = container_name - self.image_path = image_path - self.os_type = os_type - self.cloud_init_data_source = cloud_init_data_source - self.hyper_v_generation = hyper_v_generation - self.identifier = identifier - self.version = version + super().__init__(**kwargs) self.provisioning_state = None - self.resource_name = resource_name - self.status = None + self.publisher_id = publisher_id + self.content = content + self.content_version = content_version + self.sku_mappings = sku_mappings -class GalleryimagesListResult(_serialization.Model): - """List of galleryimages. +class OfferList(_serialization.Model): + """List of Offer proxy resources for the HCI cluster. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] + :ivar value: List of Offer proxy resources. + :vartype value: list[~azure.mgmt.azurestackhci.models.Offer] :ivar next_link: Link to the next set of results. :vartype next_link: str """ _validation = { + "value": {"readonly": True}, "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Galleryimages]"}, + "value": {"key": "value", "type": "[Offer]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Galleryimages"]] = None, **kwargs): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value + self.value = None self.next_link = None -class GalleryimagesPatch(_serialization.Model): - """The gallery image resource patch definition. +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 tags: Resource tags. - :vartype tags: dict[str, str] + :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.azurestackhci.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.azurestackhci.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.azurestackhci.models.ActionType """ + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "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, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.azurestackhci.models.OperationDisplay """ super().__init__(**kwargs) - self.tags = tags + 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. -class GalleryImageStatus(_serialization.Model): - """GalleryImageStatus defines the observed state of galleryimages. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: Gallery image provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the gallery image. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.GalleryImageStatusProvisioningStatus - :ivar download_status: The download status of the gallery image. - :vartype download_status: ~azure.mgmt.azurestackhci.models.GalleryImageStatusDownloadStatus - :ivar progress_percentage: The progress of the operation in percentage. - :vartype progress_percentage: int + :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 = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "GalleryImageStatusProvisioningStatus"}, - "download_status": {"key": "downloadStatus", "type": "GalleryImageStatusDownloadStatus"}, - "progress_percentage": {"key": "progressPercentage", "type": "int"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.GalleryImageStatusProvisioningStatus"] = None, - download_status: Optional["_models.GalleryImageStatusDownloadStatus"] = None, - progress_percentage: Optional[int] = None, - **kwargs - ): - """ - :keyword error_code: Gallery image provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the gallery image. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.GalleryImageStatusProvisioningStatus - :keyword download_status: The download status of the gallery image. - :paramtype download_status: ~azure.mgmt.azurestackhci.models.GalleryImageStatusDownloadStatus - :keyword progress_percentage: The progress of the operation in percentage. - :paramtype progress_percentage: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status - self.download_status = download_status - self.progress_percentage = progress_percentage + self.provider = None + self.resource = None + self.operation = None + self.description = None -class GalleryImageStatusDownloadStatus(_serialization.Model): - """The download status of the gallery image. +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 download_size_in_mb: The downloaded sized of the image in MB. - :vartype download_size_in_mb: int + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.azurestackhci.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 = { - "download_size_in_mb": {"key": "downloadSizeInMB", "type": "int"}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): - """ - :keyword download_size_in_mb: The downloaded sized of the image in MB. - :paramtype download_size_in_mb: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.download_size_in_mb = download_size_in_mb + self.value = None + self.next_link = None -class GalleryImageStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the gallery image. +class PackageVersionInfo(_serialization.Model): + """Current version of each updatable component. - :ivar operation_id: The ID of the operation performed on the gallery image. - :vartype operation_id: str - :ivar status: The status of the operation performed on the gallery image [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :ivar package_type: Package type. + :vartype package_type: str + :ivar version: Package version. + :vartype version: str + :ivar last_updated: Last time this component was updated. + :vartype last_updated: ~datetime.datetime """ _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "package_type": {"key": "packageType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, } def __init__( self, *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + package_type: Optional[str] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword operation_id: The ID of the operation performed on the gallery image. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the gallery image [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :keyword package_type: Package type. + :paramtype package_type: str + :keyword version: Package version. + :paramtype version: str + :keyword last_updated: Last time this component was updated. + :paramtype last_updated: ~datetime.datetime """ super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status + self.package_type = package_type + self.version = version + self.last_updated = last_updated -class GalleryImageVersion(_serialization.Model): - """Specifies information about the gallery image version that you want to create or update. +class PasswordCredential(_serialization.Model): + """PasswordCredential. - :ivar name: This is the version of the gallery image. - :vartype name: str - :ivar storage_profile: This is the storage profile of a Gallery Image Version. - :vartype storage_profile: ~azure.mgmt.azurestackhci.models.GalleryImageVersionStorageProfile + :ivar secret_text: + :vartype secret_text: str + :ivar key_id: + :vartype key_id: str + :ivar start_date_time: + :vartype start_date_time: ~datetime.datetime + :ivar end_date_time: + :vartype end_date_time: ~datetime.datetime """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "storage_profile": {"key": "properties.storageProfile", "type": "GalleryImageVersionStorageProfile"}, + "secret_text": {"key": "secretText", "type": "str"}, + "key_id": {"key": "keyId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, } def __init__( self, *, - name: Optional[str] = None, - storage_profile: Optional["_models.GalleryImageVersionStorageProfile"] = None, - **kwargs - ): + secret_text: Optional[str] = None, + key_id: Optional[str] = None, + start_date_time: Optional[datetime.datetime] = None, + end_date_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ - :keyword name: This is the version of the gallery image. - :paramtype name: str - :keyword storage_profile: This is the storage profile of a Gallery Image Version. - :paramtype storage_profile: ~azure.mgmt.azurestackhci.models.GalleryImageVersionStorageProfile + :keyword secret_text: + :paramtype secret_text: str + :keyword key_id: + :paramtype key_id: str + :keyword start_date_time: + :paramtype start_date_time: ~datetime.datetime + :keyword end_date_time: + :paramtype end_date_time: ~datetime.datetime """ super().__init__(**kwargs) - self.name = name - self.storage_profile = storage_profile + self.secret_text = secret_text + self.key_id = key_id + self.start_date_time = start_date_time + self.end_date_time = end_date_time + +class PerNodeExtensionState(_serialization.Model): + """Status of Arc Extension for a particular node in HCI Cluster. -class GalleryImageVersionStorageProfile(_serialization.Model): - """This is the storage profile of a Gallery Image Version. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar os_disk_image: This is the OS disk image. - :vartype os_disk_image: ~azure.mgmt.azurestackhci.models.GalleryOSDiskImage + :ivar name: Name of the node in HCI Cluster. + :vartype name: str + :ivar extension: Fully qualified resource ID for the particular Arc Extension on this node. + :vartype extension: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar state: State of Arc Extension in this node. Known values are: "NotSpecified", "Error", + "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", + "Updating", "Deleting", "Moving", "PartiallySucceeded", "PartiallyConnected", "InProgress", + "Accepted", and "Provisioning". + :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeExtensionState + :ivar instance_view: The extension instance view. + :vartype instance_view: ~azure.mgmt.azurestackhci.models.ExtensionInstanceView """ + _validation = { + "name": {"readonly": True}, + "extension": {"readonly": True}, + "type_handler_version": {"readonly": True}, + "state": {"readonly": True}, + "instance_view": {"readonly": True}, + } + _attribute_map = { - "os_disk_image": {"key": "osDiskImage", "type": "GalleryOSDiskImage"}, + "name": {"key": "name", "type": "str"}, + "extension": {"key": "extension", "type": "str"}, + "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "instance_view": {"key": "instanceView", "type": "ExtensionInstanceView"}, } - def __init__(self, *, os_disk_image: Optional["_models.GalleryOSDiskImage"] = None, **kwargs): - """ - :keyword os_disk_image: This is the OS disk image. - :paramtype os_disk_image: ~azure.mgmt.azurestackhci.models.GalleryOSDiskImage - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.os_disk_image = os_disk_image + self.name = None + self.extension = None + self.type_handler_version = None + self.state = None + self.instance_view = None -class GalleryOSDiskImage(GalleryDiskImage): - """This is the OS disk image. +class PerNodeState(_serialization.Model): + """Status of Arc agent for a particular node in HCI Cluster. Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_mb: This property indicates the size of the VHD to be created. - :vartype size_in_mb: int + :ivar name: Name of the Node in HCI Cluster. + :vartype name: str + :ivar arc_instance: Fully qualified resource ID for the Arc agent of this node. + :vartype arc_instance: str + :ivar state: State of Arc agent in this node. Known values are: "NotSpecified", "Error", + "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", + "Updating", "Deleting", "Moving", "PartiallySucceeded", "PartiallyConnected", "InProgress", + "Accepted", "Provisioning", and "DisableInProgress". + :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeArcState """ _validation = { - "size_in_mb": {"readonly": True}, + "name": {"readonly": True}, + "arc_instance": {"readonly": True}, + "state": {"readonly": True}, } _attribute_map = { - "size_in_mb": {"key": "sizeInMB", "type": "int"}, + "name": {"key": "name", "type": "str"}, + "arc_instance": {"key": "arcInstance", "type": "str"}, + "state": {"key": "state", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.name = None + self.arc_instance = None + self.state = None -class GuestAgent(ProxyResource): - """Defines the GuestAgent. - - Variables are only populated by the server, and will be ignored when sending a request. +class PrecheckResult(_serialization.Model): # pylint: disable=too-many-instance-attributes + """PrecheckResult. - :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. + :ivar name: Name of the individual test/rule/alert that was executed. Unique, not exposed to + the customer. :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: The system data. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar credentials: Username / Password Credentials to provision guest agent. - :vartype credentials: ~azure.mgmt.azurestackhci.models.GuestCredential - :ivar http_proxy_config: HTTP Proxy configuration for the VM. - :vartype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration - :ivar provisioning_action: The guest agent provisioning action. Known values are: "install", - "uninstall", and "repair". - :vartype provisioning_action: str or ~azure.mgmt.azurestackhci.models.ProvisioningAction - :ivar status: The guest agent status. - :vartype status: str - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str + :ivar tags: Key-value pairs that allow grouping/filtering individual tests. + :vartype tags: ~azure.mgmt.azurestackhci.models.PrecheckResultTags + :ivar title: User-facing name; one or more sentences indicating the direct issue. + :vartype title: str + :ivar status: The status of the check running (i.e. Failed, Succeeded, In Progress). This + answers whether the check ran, and passed or failed. Known values are: "NotYetRegistered", + "ConnectedRecently", "NotConnectedRecently", "Disconnected", "Error", "NotSpecified", + "Succeeded", "Failed", and "InProgress". + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status + :ivar severity: Severity of the result (Critical, Warning, Informational, Hidden). This answers + how important the result is. Critical is the only update-blocking severity. Known values are: + "Critical", "Warning", "Informational", and "Hidden". + :vartype severity: str or ~azure.mgmt.azurestackhci.models.Severity + :ivar description: Detailed overview of the issue and what impact the issue has on the stamp. + :vartype description: str + :ivar remediation: Set of steps that can be taken to resolve the issue found. + :vartype remediation: str + :ivar target_resource_id: The unique identifier for the affected resource (such as a node or + drive). + :vartype target_resource_id: str + :ivar target_resource_name: The name of the affected resource. + :vartype target_resource_name: str + :ivar timestamp: The Time in which the HealthCheck was called. + :vartype timestamp: ~datetime.datetime + :ivar additional_data: Property bag of key value pairs for additional information. + :vartype additional_data: str + :ivar health_check_source: The name of the services called for the HealthCheck (I.E. + Test-AzureStack, Test-Cluster). + :vartype health_check_source: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "status": {"readonly": True}, - "provisioning_state": {"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"}, - "credentials": {"key": "properties.credentials", "type": "GuestCredential"}, - "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "HttpProxyConfiguration"}, - "provisioning_action": {"key": "properties.provisioningAction", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "tags": {"key": "tags", "type": "PrecheckResultTags"}, + "title": {"key": "title", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "remediation": {"key": "remediation", "type": "str"}, + "target_resource_id": {"key": "targetResourceID", "type": "str"}, + "target_resource_name": {"key": "targetResourceName", "type": "str"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "additional_data": {"key": "additionalData", "type": "str"}, + "health_check_source": {"key": "healthCheckSource", "type": "str"}, } def __init__( self, *, - credentials: Optional["_models.GuestCredential"] = None, - http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, - provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, - **kwargs - ): - """ - :keyword credentials: Username / Password Credentials to provision guest agent. - :paramtype credentials: ~azure.mgmt.azurestackhci.models.GuestCredential - :keyword http_proxy_config: HTTP Proxy configuration for the VM. - :paramtype http_proxy_config: ~azure.mgmt.azurestackhci.models.HttpProxyConfiguration - :keyword provisioning_action: The guest agent provisioning action. Known values are: "install", - "uninstall", and "repair". - :paramtype provisioning_action: str or ~azure.mgmt.azurestackhci.models.ProvisioningAction + name: Optional[str] = None, + tags: Optional["_models.PrecheckResultTags"] = None, + title: Optional[str] = None, + status: Optional[Union[str, "_models.Status"]] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, + description: Optional[str] = None, + remediation: Optional[str] = None, + target_resource_id: Optional[str] = None, + target_resource_name: Optional[str] = None, + timestamp: Optional[datetime.datetime] = None, + additional_data: Optional[str] = None, + health_check_source: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the individual test/rule/alert that was executed. Unique, not exposed to + the customer. + :paramtype name: str + :keyword tags: Key-value pairs that allow grouping/filtering individual tests. + :paramtype tags: ~azure.mgmt.azurestackhci.models.PrecheckResultTags + :keyword title: User-facing name; one or more sentences indicating the direct issue. + :paramtype title: str + :keyword status: The status of the check running (i.e. Failed, Succeeded, In Progress). This + answers whether the check ran, and passed or failed. Known values are: "NotYetRegistered", + "ConnectedRecently", "NotConnectedRecently", "Disconnected", "Error", "NotSpecified", + "Succeeded", "Failed", and "InProgress". + :paramtype status: str or ~azure.mgmt.azurestackhci.models.Status + :keyword severity: Severity of the result (Critical, Warning, Informational, Hidden). This + answers how important the result is. Critical is the only update-blocking severity. Known + values are: "Critical", "Warning", "Informational", and "Hidden". + :paramtype severity: str or ~azure.mgmt.azurestackhci.models.Severity + :keyword description: Detailed overview of the issue and what impact the issue has on the + stamp. + :paramtype description: str + :keyword remediation: Set of steps that can be taken to resolve the issue found. + :paramtype remediation: str + :keyword target_resource_id: The unique identifier for the affected resource (such as a node or + drive). + :paramtype target_resource_id: str + :keyword target_resource_name: The name of the affected resource. + :paramtype target_resource_name: str + :keyword timestamp: The Time in which the HealthCheck was called. + :paramtype timestamp: ~datetime.datetime + :keyword additional_data: Property bag of key value pairs for additional information. + :paramtype additional_data: str + :keyword health_check_source: The name of the services called for the HealthCheck (I.E. + Test-AzureStack, Test-Cluster). + :paramtype health_check_source: str """ super().__init__(**kwargs) - self.system_data = None - self.credentials = credentials - self.http_proxy_config = http_proxy_config - self.provisioning_action = provisioning_action - self.status = None - self.provisioning_state = None - + self.name = name + self.tags = tags + self.title = title + self.status = status + self.severity = severity + self.description = description + self.remediation = remediation + self.target_resource_id = target_resource_id + self.target_resource_name = target_resource_name + self.timestamp = timestamp + self.additional_data = additional_data + self.health_check_source = health_check_source -class GuestAgentList(_serialization.Model): - """List of GuestAgent. - All required parameters must be populated in order to send to Azure. +class PrecheckResultTags(_serialization.Model): + """Key-value pairs that allow grouping/filtering individual tests. - :ivar next_link: Url to follow for getting next page of GuestAgent. - :vartype next_link: str - :ivar value: Array of GuestAgent. Required. - :vartype value: list[~azure.mgmt.azurestackhci.models.GuestAgent] + :ivar key: Key that allow grouping/filtering individual tests. + :vartype key: str + :ivar value: Value of the key that allow grouping/filtering individual tests. + :vartype value: str """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[GuestAgent]"}, + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: Url to follow for getting next page of GuestAgent. - :paramtype next_link: str - :keyword value: Array of GuestAgent. Required. - :paramtype value: list[~azure.mgmt.azurestackhci.models.GuestAgent] + :keyword key: Key that allow grouping/filtering individual tests. + :paramtype key: str + :keyword value: Value of the key that allow grouping/filtering individual tests. + :paramtype value: str """ super().__init__(**kwargs) - self.next_link = next_link + self.key = key self.value = value -class GuestAgentProfile(_serialization.Model): - """Defines the resource properties. +class Publisher(ProxyResource): + """Publisher details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar vm_uuid: Specifies the VM's unique SMBIOS ID. - :vartype vm_uuid: str - :ivar status: The status of the hybrid machine agent. Known values are: "Connected", - "Disconnected", and "Error". - :vartype status: str or ~azure.mgmt.azurestackhci.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :ivar error_details: Details about the error state. - :vartype error_details: list[~azure.mgmt.azurestackhci.models.ErrorDetail] + :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.azurestackhci.models.SystemData + :ivar provisioning_state: Provisioning State. + :vartype provisioning_state: str """ _validation = { - "vm_uuid": {"readonly": True}, - "status": {"readonly": True}, - "last_status_change": {"readonly": True}, - "agent_version": {"readonly": True}, - "error_details": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "vm_uuid": {"key": "vmUuid", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "last_status_change": {"key": "lastStatusChange", "type": "iso-8601"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uuid = None - self.status = None - self.last_status_change = None - self.agent_version = None - self.error_details = None + self.provisioning_state = None -class GuestCredential(_serialization.Model): - """Username / Password Credentials to connect to guest. +class PublisherList(_serialization.Model): + """List of Publisher proxy resources for the HCI cluster. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar username: The username to connect with the guest. - :vartype username: str - :ivar password: The password to connect with the guest. - :vartype password: str + :ivar value: List of Publisher proxy resources. + :vartype value: list[~azure.mgmt.azurestackhci.models.Publisher] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ - _attribute_map = { - "username": {"key": "username", "type": "str"}, - "password": {"key": "password", "type": "str"}, + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): - """ - :keyword username: The username to connect with the guest. - :paramtype username: str - :keyword password: The password to connect with the guest. - :paramtype password: str - """ - super().__init__(**kwargs) - self.username = username - self.password = password - - -class HardwareProfileUpdate(_serialization.Model): - """HardwareProfile - Specifies the hardware settings for the virtual machine. - - :ivar vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", - "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", - "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", - "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", - "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", - "Standard_K8S5_v1", and "Custom". - :vartype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum - :ivar processors: number of processors for the virtual machine. - :vartype processors: int - :ivar memory_gb: RAM in gb for the virtual machine. - :vartype memory_gb: int - """ - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "processors": {"key": "processors", "type": "int"}, - "memory_gb": {"key": "memoryGB", "type": "int"}, + "value": {"key": "value", "type": "[Publisher]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - vm_size: Optional[Union[str, "_models.VmSizeEnum"]] = None, - processors: Optional[int] = None, - memory_gb: Optional[int] = None, - **kwargs - ): - """ - :keyword vm_size: Known values are: "Default", "Standard_A2_v2", "Standard_A4_v2", - "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", - "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", - "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", - "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", - "Standard_K8S5_v1", and "Custom". - :paramtype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum - :keyword processors: number of processors for the virtual machine. - :paramtype processors: int - :keyword memory_gb: RAM in gb for the virtual machine. - :paramtype memory_gb: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.vm_size = vm_size - self.processors = processors - self.memory_gb = memory_gb + self.value = None + self.next_link = None -class HttpProxyConfiguration(_serialization.Model): - """HTTP Proxy configuration for the VM. +class RawCertificateData(_serialization.Model): + """RawCertificateData. - :ivar https_proxy: The httpsProxy url. - :vartype https_proxy: str + :ivar certificates: + :vartype certificates: list[str] """ _attribute_map = { - "https_proxy": {"key": "httpsProxy", "type": "str"}, + "certificates": {"key": "certificates", "type": "[str]"}, } - def __init__(self, *, https_proxy: Optional[str] = None, **kwargs): + def __init__(self, *, certificates: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword https_proxy: The httpsProxy url. - :paramtype https_proxy: str + :keyword certificates: + :paramtype certificates: list[str] """ super().__init__(**kwargs) - self.https_proxy = https_proxy + self.certificates = certificates -class HybridIdentityMetadata(ProxyResource): - """Defines the HybridIdentityMetadata. +class Sku(ProxyResource): + """Sku details. Variables are only populated by the server, and will be ignored when sending a request. @@ -1777,16 +2027,22 @@ class HybridIdentityMetadata(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar resource_uid: The unique identifier for the resource. - :vartype resource_uid: str - :ivar public_key: The Public Key. - :vartype public_key: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.azurestackhci.models.Identity - :ivar provisioning_state: The provisioning state. + :ivar provisioning_state: Provisioning State. :vartype provisioning_state: str + :ivar publisher_id: Identifier of the Publisher for the offer. + :vartype publisher_id: str + :ivar offer_id: Identifier of the Offer for the sku. + :vartype offer_id: str + :ivar content: JSON serialized catalog content of the sku offer. + :vartype content: str + :ivar content_version: The API version of the catalog service used to serve the catalog + content. + :vartype content_version: str + :ivar sku_mappings: Array of SKU mappings. + :vartype sku_mappings: list[~azure.mgmt.azurestackhci.models.SkuMappings] """ _validation = { @@ -1794,7 +2050,6 @@ class HybridIdentityMetadata(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "identity": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -1803,3048 +2058,656 @@ class HybridIdentityMetadata(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "resource_uid": {"key": "properties.resourceUid", "type": "str"}, - "public_key": {"key": "properties.publicKey", "type": "str"}, - "identity": {"key": "properties.identity", "type": "Identity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "publisher_id": {"key": "properties.publisherId", "type": "str"}, + "offer_id": {"key": "properties.offerId", "type": "str"}, + "content": {"key": "properties.content", "type": "str"}, + "content_version": {"key": "properties.contentVersion", "type": "str"}, + "sku_mappings": {"key": "properties.skuMappings", "type": "[SkuMappings]"}, } - def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs): - """ - :keyword resource_uid: The unique identifier for the resource. - :paramtype resource_uid: str - :keyword public_key: The Public Key. - :paramtype public_key: str + def __init__( + self, + *, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + content: Optional[str] = None, + content_version: Optional[str] = None, + sku_mappings: Optional[List["_models.SkuMappings"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_id: Identifier of the Publisher for the offer. + :paramtype publisher_id: str + :keyword offer_id: Identifier of the Offer for the sku. + :paramtype offer_id: str + :keyword content: JSON serialized catalog content of the sku offer. + :paramtype content: str + :keyword content_version: The API version of the catalog service used to serve the catalog + content. + :paramtype content_version: str + :keyword sku_mappings: Array of SKU mappings. + :paramtype sku_mappings: list[~azure.mgmt.azurestackhci.models.SkuMappings] """ super().__init__(**kwargs) - self.system_data = None - self.resource_uid = resource_uid - self.public_key = public_key - self.identity = None self.provisioning_state = None + self.publisher_id = publisher_id + self.offer_id = offer_id + self.content = content + self.content_version = content_version + self.sku_mappings = sku_mappings -class HybridIdentityMetadataList(_serialization.Model): - """List of HybridIdentityMetadata. +class SkuList(_serialization.Model): + """List of SKU proxy resources for the HCI cluster. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. + :ivar value: List of SKU proxy resources. + :vartype value: list[~azure.mgmt.azurestackhci.models.Sku] + :ivar next_link: Link to the next set of results. :vartype next_link: str - :ivar value: Array of HybridIdentityMetadata. Required. - :vartype value: list[~azure.mgmt.azurestackhci.models.HybridIdentityMetadata] """ _validation = { - "value": {"required": True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { + "value": {"key": "value", "type": "[Sku]"}, "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, - } - - def __init__(self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. - :paramtype next_link: str - :keyword value: Array of HybridIdentityMetadata. Required. - :paramtype value: list[~azure.mgmt.azurestackhci.models.HybridIdentityMetadata] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class Identity(_serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + self.value = None + self.next_link = None -class InterfaceDNSSettings(_serialization.Model): - """InterfaceDNSSettings. +class SkuMappings(_serialization.Model): + """SKU Mapping details. - :ivar dns_servers: List of DNS server IP Addresses for the interface. - :vartype dns_servers: list[str] + :ivar catalog_plan_id: Identifier of the CatalogPlan for the sku. + :vartype catalog_plan_id: str + :ivar marketplace_sku_id: Identifier for the sku. + :vartype marketplace_sku_id: str + :ivar marketplace_sku_versions: Array of SKU versions available. + :vartype marketplace_sku_versions: list[str] """ _attribute_map = { - "dns_servers": {"key": "dnsServers", "type": "[str]"}, + "catalog_plan_id": {"key": "catalogPlanId", "type": "str"}, + "marketplace_sku_id": {"key": "marketplaceSkuId", "type": "str"}, + "marketplace_sku_versions": {"key": "marketplaceSkuVersions", "type": "[str]"}, } - def __init__(self, *, dns_servers: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + catalog_plan_id: Optional[str] = None, + marketplace_sku_id: Optional[str] = None, + marketplace_sku_versions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword dns_servers: List of DNS server IP Addresses for the interface. - :paramtype dns_servers: list[str] + :keyword catalog_plan_id: Identifier of the CatalogPlan for the sku. + :paramtype catalog_plan_id: str + :keyword marketplace_sku_id: Identifier for the sku. + :paramtype marketplace_sku_id: str + :keyword marketplace_sku_versions: Array of SKU versions available. + :paramtype marketplace_sku_versions: list[str] """ super().__init__(**kwargs) - self.dns_servers = dns_servers + self.catalog_plan_id = catalog_plan_id + self.marketplace_sku_id = marketplace_sku_id + self.marketplace_sku_versions = marketplace_sku_versions -class IpConfiguration(_serialization.Model): - """InterfaceIPConfiguration iPConfiguration in a network interface. +class SoftwareAssuranceChangeRequest(_serialization.Model): + """SoftwareAssuranceChangeRequest. - :ivar name: Name - The name of the resource that is unique within a resource group. This name - can be used to access the resource. - :vartype name: str - :ivar properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. - :vartype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + :ivar properties: + :vartype properties: ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequestProperties """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "IpConfigurationProperties"}, + "properties": {"key": "properties", "type": "SoftwareAssuranceChangeRequestProperties"}, } def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.IpConfigurationProperties"] = None, **kwargs - ): + self, *, properties: Optional["_models.SoftwareAssuranceChangeRequestProperties"] = None, **kwargs: Any + ) -> None: """ - :keyword name: Name - The name of the resource that is unique within a resource group. This - name can be used to access the resource. - :paramtype name: str - :keyword properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. - :paramtype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + :keyword properties: + :paramtype properties: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequestProperties """ super().__init__(**kwargs) - self.name = name self.properties = properties -class IpConfigurationProperties(_serialization.Model): - """InterfaceIPConfigurationPropertiesFormat properties of IP configuration. - - :ivar gateway: Gateway for network interface. - :vartype gateway: str - :ivar prefix_length: prefixLength for network interface. - :vartype prefix_length: str - :ivar private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. - :vartype private_ip_address: str - :ivar private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address - allocation method. Possible values include: 'Static', 'Dynamic'. Known values are: "Dynamic" - and "Static". - :vartype private_ip_allocation_method: str or - ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum - :ivar subnet: Subnet - Name of Subnet bound to the IP configuration. - :vartype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet +class SoftwareAssuranceChangeRequestProperties(_serialization.Model): + """SoftwareAssuranceChangeRequestProperties. + + :ivar software_assurance_intent: Customer Intent for Software Assurance Benefit. Known values + are: "Enable" and "Disable". + :vartype software_assurance_intent: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceIntent """ _attribute_map = { - "gateway": {"key": "gateway", "type": "str"}, - "prefix_length": {"key": "prefixLength", "type": "str"}, - "private_ip_address": {"key": "privateIPAddress", "type": "str"}, - "private_ip_allocation_method": {"key": "privateIPAllocationMethod", "type": "str"}, - "subnet": {"key": "subnet", "type": "IpConfigurationPropertiesSubnet"}, + "software_assurance_intent": {"key": "softwareAssuranceIntent", "type": "str"}, } def __init__( self, *, - gateway: Optional[str] = None, - prefix_length: Optional[str] = None, - private_ip_address: Optional[str] = None, - private_ip_allocation_method: Optional[Union[str, "_models.PrivateIPAllocationMethodEnum"]] = None, - subnet: Optional["_models.IpConfigurationPropertiesSubnet"] = None, - **kwargs - ): + software_assurance_intent: Optional[Union[str, "_models.SoftwareAssuranceIntent"]] = None, + **kwargs: Any + ) -> None: """ - :keyword gateway: Gateway for network interface. - :paramtype gateway: str - :keyword prefix_length: prefixLength for network interface. - :paramtype prefix_length: str - :keyword private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. - :paramtype private_ip_address: str - :keyword private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address - allocation method. Possible values include: 'Static', 'Dynamic'. Known values are: "Dynamic" - and "Static". - :paramtype private_ip_allocation_method: str or - ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum - :keyword subnet: Subnet - Name of Subnet bound to the IP configuration. - :paramtype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet + :keyword software_assurance_intent: Customer Intent for Software Assurance Benefit. Known + values are: "Enable" and "Disable". + :paramtype software_assurance_intent: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceIntent """ super().__init__(**kwargs) - self.gateway = gateway - self.prefix_length = prefix_length - self.private_ip_address = private_ip_address - self.private_ip_allocation_method = private_ip_allocation_method - self.subnet = subnet + self.software_assurance_intent = software_assurance_intent -class IpConfigurationPropertiesSubnet(_serialization.Model): - """Subnet - Name of Subnet bound to the IP configuration. +class SoftwareAssuranceProperties(_serialization.Model): + """Software Assurance properties of the cluster. - :ivar id: ID - The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :vartype id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar software_assurance_status: Status of the Software Assurance for the cluster. Known values + are: "Enabled" and "Disabled". + :vartype software_assurance_status: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceStatus + :ivar software_assurance_intent: Customer Intent for Software Assurance Benefit. Known values + are: "Enable" and "Disable". + :vartype software_assurance_intent: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceIntent + :ivar last_updated: TimeStamp denoting the latest SA benefit applicability is validated. + :vartype last_updated: ~datetime.datetime """ + _validation = { + "last_updated": {"readonly": True}, + } + _attribute_map = { - "id": {"key": "id", "type": "str"}, + "software_assurance_status": {"key": "softwareAssuranceStatus", "type": "str"}, + "software_assurance_intent": {"key": "softwareAssuranceIntent", "type": "str"}, + "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: ID - The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id + def __init__( + self, + *, + software_assurance_status: Optional[Union[str, "_models.SoftwareAssuranceStatus"]] = None, + software_assurance_intent: Optional[Union[str, "_models.SoftwareAssuranceIntent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword software_assurance_status: Status of the Software Assurance for the cluster. Known + values are: "Enabled" and "Disabled". + :paramtype software_assurance_status: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceStatus + :keyword software_assurance_intent: Customer Intent for Software Assurance Benefit. Known + values are: "Enable" and "Disable". + :paramtype software_assurance_intent: str or + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceIntent + """ + super().__init__(**kwargs) + self.software_assurance_status = software_assurance_status + self.software_assurance_intent = software_assurance_intent + self.last_updated = None -class IPPool(_serialization.Model): - """IPPool. +class Step(_serialization.Model): + """Progress representation of the update run steps. - :ivar ip_pool_type: ip pool type. Known values are: "vm" and "vippool". - :vartype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum - :ivar start: start of the ip address pool. - :vartype start: str - :ivar end: end of the ip address pool. - :vartype end: str - :ivar info: - :vartype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo + :ivar name: Name of the step. + :vartype name: str + :ivar description: More detailed description of the step. + :vartype description: str + :ivar error_message: Error message, specified if the step is in a failed state. + :vartype error_message: str + :ivar status: Status of the step, bubbled up from the ECE action plan for installation + attempts. Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'. + :vartype status: str + :ivar start_time_utc: When the step started, or empty if it has not started executing. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: When the step reached a terminal state. + :vartype end_time_utc: ~datetime.datetime + :ivar last_updated_time_utc: Completion time of this step or the last completed sub-step. + :vartype last_updated_time_utc: ~datetime.datetime + :ivar steps: Recursive model for child steps of this step. + :vartype steps: list[~azure.mgmt.azurestackhci.models.Step] """ _attribute_map = { - "ip_pool_type": {"key": "ipPoolType", "type": "str"}, - "start": {"key": "start", "type": "str"}, - "end": {"key": "end", "type": "str"}, - "info": {"key": "info", "type": "IPPoolInfo"}, + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time_utc": {"key": "startTimeUtc", "type": "iso-8601"}, + "end_time_utc": {"key": "endTimeUtc", "type": "iso-8601"}, + "last_updated_time_utc": {"key": "lastUpdatedTimeUtc", "type": "iso-8601"}, + "steps": {"key": "steps", "type": "[Step]"}, } def __init__( self, *, - ip_pool_type: Optional[Union[str, "_models.IPPoolTypeEnum"]] = None, - start: Optional[str] = None, - end: Optional[str] = None, - info: Optional["_models.IPPoolInfo"] = None, - **kwargs - ): - """ - :keyword ip_pool_type: ip pool type. Known values are: "vm" and "vippool". - :paramtype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum - :keyword start: start of the ip address pool. - :paramtype start: str - :keyword end: end of the ip address pool. - :paramtype end: str - :keyword info: - :paramtype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo + name: Optional[str] = None, + description: Optional[str] = None, + error_message: Optional[str] = None, + status: Optional[str] = None, + start_time_utc: Optional[datetime.datetime] = None, + end_time_utc: Optional[datetime.datetime] = None, + last_updated_time_utc: Optional[datetime.datetime] = None, + steps: Optional[List["_models.Step"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the step. + :paramtype name: str + :keyword description: More detailed description of the step. + :paramtype description: str + :keyword error_message: Error message, specified if the step is in a failed state. + :paramtype error_message: str + :keyword status: Status of the step, bubbled up from the ECE action plan for installation + attempts. Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'. + :paramtype status: str + :keyword start_time_utc: When the step started, or empty if it has not started executing. + :paramtype start_time_utc: ~datetime.datetime + :keyword end_time_utc: When the step reached a terminal state. + :paramtype end_time_utc: ~datetime.datetime + :keyword last_updated_time_utc: Completion time of this step or the last completed sub-step. + :paramtype last_updated_time_utc: ~datetime.datetime + :keyword steps: Recursive model for child steps of this step. + :paramtype steps: list[~azure.mgmt.azurestackhci.models.Step] """ super().__init__(**kwargs) - self.ip_pool_type = ip_pool_type - self.start = start - self.end = end - self.info = info - + self.name = name + self.description = description + self.error_message = error_message + self.status = status + self.start_time_utc = start_time_utc + self.end_time_utc = end_time_utc + self.last_updated_time_utc = last_updated_time_utc + self.steps = steps -class IPPoolInfo(_serialization.Model): - """IPPoolInfo. - Variables are only populated by the server, and will be ignored when sending a request. +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. - :ivar used: no. of ip addresses allocated from the ip pool. - :vartype used: str - :ivar available: no. of ip addresses available in the ip pool. - :vartype available: str + :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.azurestackhci.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.azurestackhci.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ - _validation = { - "used": {"readonly": True}, - "available": {"readonly": True}, - } - _attribute_map = { - "used": {"key": "used", "type": "str"}, - "available": {"key": "available", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.used = None - self.available = None - - -class MachineExtension(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The geo-location where the resource lives. - :vartype location: str - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar name: The name of the resource. - :vartype name: str - :ivar id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar type: The type of the resource. - :vartype type: str - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type_properties_type: Specifies the type of the extension; an example is - "CustomScriptExtension". - :vartype type_properties_type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar instance_view: The machine extension instance view. - :vartype instance_view: ~azure.mgmt.azurestackhci.models.MachineExtensionPropertiesInstanceView - """ - - _validation = { - "system_data": {"readonly": True}, - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type_properties_type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "MachineExtensionPropertiesInstanceView"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type_properties_type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - instance_view: Optional["_models.MachineExtensionPropertiesInstanceView"] = None, - **kwargs - ): - """ - :keyword location: The geo-location where the resource lives. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type_properties_type: Specifies the type of the extension; an example is - "CustomScriptExtension". - :paramtype type_properties_type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON - :keyword instance_view: The machine extension instance view. - :paramtype instance_view: - ~azure.mgmt.azurestackhci.models.MachineExtensionPropertiesInstanceView - """ - super().__init__(**kwargs) - self.location = location - self.system_data = None - self.tags = tags - self.name = None - self.id = None - self.type = None - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type_properties_type = type_properties_type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.provisioning_state = None - self.instance_view = instance_view - - -class MachineExtensionInstanceView(_serialization.Model): - """Describes the Machine Extension Instance View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The machine extension name. - :vartype name: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar status: Instance view status. - :vartype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "type_handler_version": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, - } - - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): - """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus - """ - super().__init__(**kwargs) - self.name = None - self.type = None - self.type_handler_version = None - self.status = status - - -class MachineExtensionInstanceViewStatus(_serialization.Model): - """Instance view status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The status code. - :vartype code: str - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.azurestackhci.models.StatusLevelTypes - :ivar display_status: The short localizable label for the status. - :vartype display_status: str - :ivar message: The detailed status message, including for alerts and error messages. - :vartype message: str - :ivar time: The time of the status. - :vartype time: ~datetime.datetime - """ - - _validation = { - "code": {"readonly": True}, - "level": {"readonly": True}, - "display_status": {"readonly": True}, - "message": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.code = None - self.level = None - self.display_status = None - self.message = None - self.time = None - - -class MachineExtensionPropertiesInstanceView(MachineExtensionInstanceView): - """The machine extension instance view. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The machine extension name. - :vartype name: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar status: Instance view status. - :vartype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "type_handler_version": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, - } - - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): - """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.azurestackhci.models.MachineExtensionInstanceViewStatus - """ - super().__init__(status=status, **kwargs) - - -class MachineExtensionsListResult(_serialization.Model): - """Describes the Machine Extensions List Result. - - :ivar value: The list of extensions. - :vartype value: list[~azure.mgmt.azurestackhci.models.MachineExtension] - :ivar next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachineExtension]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MachineExtension"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: The list of extensions. - :paramtype value: list[~azure.mgmt.azurestackhci.models.MachineExtension] - :keyword next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourcePatch(_serialization.Model): - """Object containing updates for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class MachineExtensionUpdate(ResourcePatch): - """Describes a Machine Extension Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON - """ - super().__init__(tags=tags, **kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - - -class Marketplacegalleryimages(TrackedResource): # pylint: disable=too-many-instance-attributes - """The marketplace gallery image resource definition. - - 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 Azure. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar container_name: Container Name for storage container. - :vartype container_name: str - :ivar os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes - :ivar cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init [Azure, NoCloud]. Known values are: "NoCloud" and "Azure". - :vartype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :ivar identifier: This is the gallery image definition identifier. - :vartype identifier: ~azure.mgmt.azurestackhci.models.GalleryImageIdentifier - :ivar version: Specifies information about the gallery image version that you want to create or - update. - :vartype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: MarketplaceGalleryImageStatus defines the observed state of - marketplacegalleryimages. - :vartype status: ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "container_name": {"key": "properties.containerName", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "cloud_init_data_source": {"key": "properties.cloudInitDataSource", "type": "str"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "identifier": {"key": "properties.identifier", "type": "GalleryImageIdentifier"}, - "version": {"key": "properties.version", "type": "GalleryImageVersion"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "MarketplaceGalleryImageStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - container_name: Optional[str] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, - cloud_init_data_source: Optional[Union[str, "_models.CloudInitDataSource"]] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - identifier: Optional["_models.GalleryImageIdentifier"] = None, - version: Optional["_models.GalleryImageVersion"] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword container_name: Container Name for storage container. - :paramtype container_name: str - :keyword os_type: operating system type that the gallery image uses. Expected to be linux or - windows. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes - :keyword cloud_init_data_source: Datasource for the gallery image when provisioning with - cloud-init [Azure, NoCloud]. Known values are: "NoCloud" and "Azure". - :paramtype cloud_init_data_source: str or ~azure.mgmt.azurestackhci.models.CloudInitDataSource - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :keyword identifier: This is the gallery image definition identifier. - :paramtype identifier: ~azure.mgmt.azurestackhci.models.GalleryImageIdentifier - :keyword version: Specifies information about the gallery image version that you want to create - or update. - :paramtype version: ~azure.mgmt.azurestackhci.models.GalleryImageVersion - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.container_name = container_name - self.os_type = os_type - self.cloud_init_data_source = cloud_init_data_source - self.hyper_v_generation = hyper_v_generation - self.identifier = identifier - self.version = version - self.provisioning_state = None - self.resource_name = resource_name - self.status = None - - -class MarketplacegalleryimagesListResult(_serialization.Model): - """List of marketplacegalleryimages. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The itemed list of marketplacegalleryimages. - :vartype value: list[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Marketplacegalleryimages]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Marketplacegalleryimages"]] = None, **kwargs): - """ - :keyword value: The itemed list of marketplacegalleryimages. - :paramtype value: list[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class MarketplacegalleryimagesPatch(_serialization.Model): - """The marketplace gallery image resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class MarketplaceGalleryImageStatus(_serialization.Model): - """MarketplaceGalleryImageStatus defines the observed state of marketplacegalleryimages. - - :ivar error_code: Marketplace gallery image provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the marketplace gallery image. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusProvisioningStatus - :ivar download_status: The download status of the marketplace gallery image. - :vartype download_status: - ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusDownloadStatus - :ivar progress_percentage: The progress of the operation in percentage. - :vartype progress_percentage: int - """ - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "MarketplaceGalleryImageStatusProvisioningStatus"}, - "download_status": {"key": "downloadStatus", "type": "MarketplaceGalleryImageStatusDownloadStatus"}, - "progress_percentage": {"key": "progressPercentage", "type": "int"}, - } - - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.MarketplaceGalleryImageStatusProvisioningStatus"] = None, - download_status: Optional["_models.MarketplaceGalleryImageStatusDownloadStatus"] = None, - progress_percentage: Optional[int] = None, - **kwargs - ): - """ - :keyword error_code: Marketplace gallery image provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the marketplace gallery image. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusProvisioningStatus - :keyword download_status: The download status of the marketplace gallery image. - :paramtype download_status: - ~azure.mgmt.azurestackhci.models.MarketplaceGalleryImageStatusDownloadStatus - :keyword progress_percentage: The progress of the operation in percentage. - :paramtype progress_percentage: int - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status - self.download_status = download_status - self.progress_percentage = progress_percentage - - -class MarketplaceGalleryImageStatusDownloadStatus(_serialization.Model): - """The download status of the marketplace gallery image. - - :ivar download_size_in_mb: The downloaded sized of the image in MB. - :vartype download_size_in_mb: int - """ - - _attribute_map = { - "download_size_in_mb": {"key": "downloadSizeInMB", "type": "int"}, - } - - def __init__(self, *, download_size_in_mb: Optional[int] = None, **kwargs): - """ - :keyword download_size_in_mb: The downloaded sized of the image in MB. - :paramtype download_size_in_mb: int - """ - super().__init__(**kwargs) - self.download_size_in_mb = download_size_in_mb - - -class MarketplaceGalleryImageStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the marketplace gallery image. - - :ivar operation_id: The ID of the operation performed on the marketplace gallery image. - :vartype operation_id: str - :ivar status: The status of the operation performed on the marketplace gallery image - [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): - """ - :keyword operation_id: The ID of the operation performed on the marketplace gallery image. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the marketplace gallery image - [Succeeded, Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status - - -class Networkinterfaces(TrackedResource): # pylint: disable=too-many-instance-attributes - """The network interface resource definition. - - 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 Azure. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar ip_configurations: IPConfigurations - A list of IPConfigurations of the network - interface. - :vartype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] - :ivar mac_address: MacAddress - The MAC address of the network interface. - :vartype mac_address: str - :ivar dns_settings: DNS Settings for the interface. - :vartype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: NetworkInterfaceStatus defines the observed state of network interfaces. - :vartype status: ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "ip_configurations": {"key": "properties.ipConfigurations", "type": "[IpConfiguration]"}, - "mac_address": {"key": "properties.macAddress", "type": "str"}, - "dns_settings": {"key": "properties.dnsSettings", "type": "InterfaceDNSSettings"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "NetworkInterfaceStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - ip_configurations: Optional[List["_models.IpConfiguration"]] = None, - mac_address: Optional[str] = None, - dns_settings: Optional["_models.InterfaceDNSSettings"] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword ip_configurations: IPConfigurations - A list of IPConfigurations of the network - interface. - :paramtype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] - :keyword mac_address: MacAddress - The MAC address of the network interface. - :paramtype mac_address: str - :keyword dns_settings: DNS Settings for the interface. - :paramtype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.ip_configurations = ip_configurations - self.mac_address = mac_address - self.dns_settings = dns_settings - self.provisioning_state = None - self.resource_name = resource_name - self.status = None - - -class NetworkinterfacesListResult(_serialization.Model): - """NetworkinterfacesListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Networkinterfaces]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Networkinterfaces"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NetworkinterfacesPatch(_serialization.Model): - """The network interface resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class NetworkInterfaceStatus(_serialization.Model): - """NetworkInterfaceStatus defines the observed state of network interfaces. - - :ivar error_code: NetworkInterface provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the network interface. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatusProvisioningStatus - """ - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "NetworkInterfaceStatusProvisioningStatus"}, - } - - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.NetworkInterfaceStatusProvisioningStatus"] = None, - **kwargs - ): - """ - :keyword error_code: NetworkInterface provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the network interface. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.NetworkInterfaceStatusProvisioningStatus - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status - - -class NetworkInterfaceStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the network interface. - - :ivar operation_id: The ID of the operation performed on the network interface. - :vartype operation_id: str - :ivar status: The status of the operation performed on the network interface [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): - """ - :keyword operation_id: The ID of the operation performed on the network interface. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the network interface [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status - - -class NetworkProfileUpdate(_serialization.Model): - """NetworkProfile - describes the network update configuration the virtual machine. - - :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the - virtual machine. - :vartype network_interfaces: - list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] - """ - - _attribute_map = { - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkProfileUpdateNetworkInterfacesItem]"}, - } - - def __init__( - self, - *, - network_interfaces: Optional[List["_models.NetworkProfileUpdateNetworkInterfacesItem"]] = None, - **kwargs - ): - """ - :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to - the virtual machine. - :paramtype network_interfaces: - list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] - """ - super().__init__(**kwargs) - self.network_interfaces = network_interfaces - - -class NetworkProfileUpdateNetworkInterfacesItem(_serialization.Model): - """NetworkProfileUpdateNetworkInterfacesItem. - - :ivar id: ID - Resource ID of the network interface. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: ID - Resource ID of the network interface. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -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.azurestackhci.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.azurestackhci.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.azurestackhci.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): - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.azurestackhci.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): - """ """ - 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.azurestackhci.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): - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class PerNodeExtensionState(_serialization.Model): - """Status of Arc Extension for a particular node in HCI Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the node in HCI Cluster. - :vartype name: str - :ivar extension: Fully qualified resource ID for the particular Arc Extension on this node. - :vartype extension: str - :ivar state: State of Arc Extension in this node. Known values are: "NotSpecified", "Error", - "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", and "Moving". - :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeExtensionState - """ - - _validation = { - "name": {"readonly": True}, - "extension": {"readonly": True}, - "state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "extension": {"key": "extension", "type": "str"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.name = None - self.extension = None - self.state = None - - -class PerNodeState(_serialization.Model): - """Status of Arc agent for a particular node in HCI Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Node in HCI Cluster. - :vartype name: str - :ivar arc_instance: Fully qualified resource ID for the Arc agent of this node. - :vartype arc_instance: str - :ivar state: State of Arc agent in this node. Known values are: "NotSpecified", "Error", - "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", and "Moving". - :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeArcState - """ - - _validation = { - "name": {"readonly": True}, - "arc_instance": {"readonly": True}, - "state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "arc_instance": {"key": "arcInstance", "type": "str"}, - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.name = None - self.arc_instance = None - self.state = None - - -class Storagecontainers(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The storage container resource definition. - - 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 Azure. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: The resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar extended_location: - :vartype extended_location: ~azure.mgmt.azurestackhci.models.StoragecontainersExtendedLocation - :ivar path: Path of the storage container on the disk. - :vartype path: str - :ivar provisioning_state: - :vartype provisioning_state: str - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar available_size_mb: Amount of space available on the disk in MB. - :vartype available_size_mb: int - :ivar container_size_mb: Total size of the disk in MB. - :vartype container_size_mb: int - :ivar status: storageContainerStatus defines the observed state of storagecontainers. - :vartype status: ~azure.mgmt.azurestackhci.models.StorageContainerStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "available_size_mb": {"readonly": True}, - "container_size_mb": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "StoragecontainersExtendedLocation"}, - "path": {"key": "properties.path", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "available_size_mb": {"key": "properties.availableSizeMB", "type": "int"}, - "container_size_mb": {"key": "properties.containerSizeMB", "type": "int"}, - "status": {"key": "properties.status", "type": "StorageContainerStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.StoragecontainersExtendedLocation"] = None, - path: Optional[str] = None, - provisioning_state: Optional[str] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword location: The resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.azurestackhci.models.StoragecontainersExtendedLocation - :keyword path: Path of the storage container on the disk. - :paramtype path: str - :keyword provisioning_state: - :paramtype provisioning_state: str - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - self.extended_location = extended_location - self.path = path - self.provisioning_state = provisioning_state - self.resource_name = resource_name - self.available_size_mb = None - self.container_size_mb = None - self.status = None - - -class StoragecontainersExtendedLocation(_serialization.Model): - """StoragecontainersExtendedLocation. - - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class StoragecontainersListResult(_serialization.Model): - """StoragecontainersListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Storagecontainers] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Storagecontainers]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Storagecontainers"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Storagecontainers] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class StoragecontainersPatch(_serialization.Model): - """The storage container resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class StorageContainerStatus(_serialization.Model): - """storageContainerStatus defines the observed state of storagecontainers. - - :ivar error_code: StorageContainer provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar available_size_mb: Amount of space available on the disk in MB. - :vartype available_size_mb: int - :ivar container_size_mb: Total size of the disk in MB. - :vartype container_size_mb: int - :ivar provisioning_status: The provisioning status of the storage container. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.StorageContainerStatusProvisioningStatus - """ - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "available_size_mb": {"key": "availableSizeMB", "type": "int"}, - "container_size_mb": {"key": "containerSizeMB", "type": "int"}, - "provisioning_status": {"key": "provisioningStatus", "type": "StorageContainerStatusProvisioningStatus"}, - } - - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - available_size_mb: Optional[int] = None, - container_size_mb: Optional[int] = None, - provisioning_status: Optional["_models.StorageContainerStatusProvisioningStatus"] = None, - **kwargs - ): - """ - :keyword error_code: StorageContainer provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword available_size_mb: Amount of space available on the disk in MB. - :paramtype available_size_mb: int - :keyword container_size_mb: Total size of the disk in MB. - :paramtype container_size_mb: int - :keyword provisioning_status: The provisioning status of the storage container. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.StorageContainerStatusProvisioningStatus - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.available_size_mb = available_size_mb - self.container_size_mb = container_size_mb - self.provisioning_status = provisioning_status - - -class StorageContainerStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the storage container. - - :ivar operation_id: The ID of the operation performed on the storage container. - :vartype operation_id: str - :ivar status: The status of the operation performed on the storage container [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): - """ - :keyword operation_id: The ID of the operation performed on the storage container. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the storage container [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status - - -class StorageProfileUpdate(_serialization.Model): - """StorageProfileUpdate. - - :ivar data_disks: adds data disks to the virtual machine for the update call. - :vartype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] - """ - - _attribute_map = { - "data_disks": {"key": "dataDisks", "type": "[StorageProfileUpdateDataDisksItem]"}, - } - - def __init__(self, *, data_disks: Optional[List["_models.StorageProfileUpdateDataDisksItem"]] = None, **kwargs): - """ - :keyword data_disks: adds data disks to the virtual machine for the update call. - :paramtype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] - """ - super().__init__(**kwargs) - self.data_disks = data_disks - - -class StorageProfileUpdateDataDisksItem(_serialization.Model): - """StorageProfileUpdateDataDisksItem. - - :ivar name: - :vartype name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs): - """ - :keyword name: - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -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.azurestackhci.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.azurestackhci.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 - ): - """ - :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.azurestackhci.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.azurestackhci.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 Virtualharddisks(TrackedResource): # pylint: disable=too-many-instance-attributes - """The virtual hard disk resource definition. - - 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 Azure. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar block_size_bytes: - :vartype block_size_bytes: int - :ivar disk_size_bytes: diskSizeBytes - size of the disk in GB. - :vartype disk_size_bytes: int - :ivar dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. - :vartype dynamic: bool - :ivar logical_sector_bytes: - :vartype logical_sector_bytes: int - :ivar physical_sector_bytes: - :vartype physical_sector_bytes: int - :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :vartype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :ivar disk_file_format: The format of the actual VHD file [vhd, vhdx]. Known values are: "vhdx" - and "vhd". - :vartype disk_file_format: str or ~azure.mgmt.azurestackhci.models.DiskFileFormat - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar container_id: Storage ContainerID of the storage container to be used for VHD. - :vartype container_id: str - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: VirtualHardDiskStatus defines the observed state of virtualharddisks. - :vartype status: ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "block_size_bytes": {"key": "properties.blockSizeBytes", "type": "int"}, - "disk_size_bytes": {"key": "properties.diskSizeBytes", "type": "int"}, - "dynamic": {"key": "properties.dynamic", "type": "bool"}, - "logical_sector_bytes": {"key": "properties.logicalSectorBytes", "type": "int"}, - "physical_sector_bytes": {"key": "properties.physicalSectorBytes", "type": "int"}, - "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "disk_file_format": {"key": "properties.diskFileFormat", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "container_id": {"key": "properties.containerId", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "VirtualHardDiskStatus"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - block_size_bytes: Optional[int] = None, - disk_size_bytes: Optional[int] = None, - dynamic: Optional[bool] = None, - logical_sector_bytes: Optional[int] = None, - physical_sector_bytes: Optional[int] = None, - hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - disk_file_format: Optional[Union[str, "_models.DiskFileFormat"]] = None, - container_id: Optional[str] = None, - resource_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword block_size_bytes: - :paramtype block_size_bytes: int - :keyword disk_size_bytes: diskSizeBytes - size of the disk in GB. - :paramtype disk_size_bytes: int - :keyword dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. - :paramtype dynamic: bool - :keyword logical_sector_bytes: - :paramtype logical_sector_bytes: int - :keyword physical_sector_bytes: - :paramtype physical_sector_bytes: int - :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine [V1, V2]. Known - values are: "V1" and "V2". - :paramtype hyper_v_generation: str or ~azure.mgmt.azurestackhci.models.HyperVGeneration - :keyword disk_file_format: The format of the actual VHD file [vhd, vhdx]. Known values are: - "vhdx" and "vhd". - :paramtype disk_file_format: str or ~azure.mgmt.azurestackhci.models.DiskFileFormat - :keyword container_id: Storage ContainerID of the storage container to be used for VHD. - :paramtype container_id: str - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.block_size_bytes = block_size_bytes - self.disk_size_bytes = disk_size_bytes - self.dynamic = dynamic - self.logical_sector_bytes = logical_sector_bytes - self.physical_sector_bytes = physical_sector_bytes - self.hyper_v_generation = hyper_v_generation - self.disk_file_format = disk_file_format - self.provisioning_state = None - self.container_id = container_id - self.resource_name = resource_name - self.status = None - - -class VirtualharddisksListResult(_serialization.Model): - """VirtualharddisksListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Virtualharddisks]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Virtualharddisks"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualharddisksPatch(_serialization.Model): - """The virtual hard disk resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class VirtualHardDiskStatus(_serialization.Model): - """VirtualHardDiskStatus defines the observed state of virtualharddisks. - - :ivar error_code: VirtualHardDisk provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the virtual hard disk. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatusProvisioningStatus - """ - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "VirtualHardDiskStatusProvisioningStatus"}, - } - - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.VirtualHardDiskStatusProvisioningStatus"] = None, - **kwargs - ): - """ - :keyword error_code: VirtualHardDisk provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the virtual hard disk. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualHardDiskStatusProvisioningStatus - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status - - -class VirtualHardDiskStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual hard disk. - - :ivar operation_id: The ID of the operation performed on the virtual hard disk. - :vartype operation_id: str - :ivar status: The status of the operation performed on the virtual hard disk [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): - """ - :keyword operation_id: The ID of the operation performed on the virtual hard disk. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the virtual hard disk [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status - - -class Virtualmachines(TrackedResource): # pylint: disable=too-many-instance-attributes - """The virtual machine resource definition. - - 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 Azure. - - :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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.azurestackhci.models.Identity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. - :vartype hardware_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile - :ivar network_profile: NetworkProfile - describes the network configuration the virtual - machine. - :vartype network_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile - :ivar os_profile: OsProfile - describes the configuration of the operating system and sets - login data. - :vartype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar security_profile: SecurityProfile - Specifies the security settings for the virtual - machine. - :vartype security_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile - :ivar storage_profile: StorageProfile - contains information about the disks and storage - information for the virtual machine. - :vartype storage_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar status: VirtualMachineStatus defines the observed state of virtualmachines. - :vartype status: ~azure.mgmt.azurestackhci.models.VirtualMachineStatus - :ivar guest_agent_profile: Guest agent status properties. - :vartype guest_agent_profile: ~azure.mgmt.azurestackhci.models.GuestAgentProfile - :ivar vm_id: Unique identifier for the vm resource. - :vartype vm_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - "vm_id": {"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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "identity": {"key": "identity", "type": "Identity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "VirtualmachinesPropertiesHardwareProfile"}, - "network_profile": {"key": "properties.networkProfile", "type": "VirtualmachinesPropertiesNetworkProfile"}, - "os_profile": {"key": "properties.osProfile", "type": "VirtualmachinesPropertiesOsProfile"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "security_profile": {"key": "properties.securityProfile", "type": "VirtualmachinesPropertiesSecurityProfile"}, - "storage_profile": {"key": "properties.storageProfile", "type": "VirtualmachinesPropertiesStorageProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "status": {"key": "properties.status", "type": "VirtualMachineStatus"}, - "guest_agent_profile": {"key": "properties.guestAgentProfile", "type": "GuestAgentProfile"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - identity: Optional["_models.Identity"] = None, - hardware_profile: Optional["_models.VirtualmachinesPropertiesHardwareProfile"] = None, - network_profile: Optional["_models.VirtualmachinesPropertiesNetworkProfile"] = None, - os_profile: Optional["_models.VirtualmachinesPropertiesOsProfile"] = None, - resource_name: Optional[str] = None, - security_profile: Optional["_models.VirtualmachinesPropertiesSecurityProfile"] = None, - storage_profile: Optional["_models.VirtualmachinesPropertiesStorageProfile"] = None, - guest_agent_profile: Optional["_models.GuestAgentProfile"] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.azurestackhci.models.Identity - :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. - :paramtype hardware_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile - :keyword network_profile: NetworkProfile - describes the network configuration the virtual - machine. - :paramtype network_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile - :keyword os_profile: OsProfile - describes the configuration of the operating system and sets - login data. - :paramtype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str - :keyword security_profile: SecurityProfile - Specifies the security settings for the virtual - machine. - :paramtype security_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile - :keyword storage_profile: StorageProfile - contains information about the disks and storage - information for the virtual machine. - :paramtype storage_profile: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile - :keyword guest_agent_profile: Guest agent status properties. - :paramtype guest_agent_profile: ~azure.mgmt.azurestackhci.models.GuestAgentProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.identity = identity - self.system_data = None - self.hardware_profile = hardware_profile - self.network_profile = network_profile - self.os_profile = os_profile - self.resource_name = resource_name - self.security_profile = security_profile - self.storage_profile = storage_profile - self.provisioning_state = None - self.status = None - self.guest_agent_profile = guest_agent_profile - self.vm_id = None - - -class VirtualmachinesListResult(_serialization.Model): - """VirtualmachinesListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Virtualmachines]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Virtualmachines"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualmachinesPatch(_serialization.Model): - """The virtual machine resource patch definition. - - :ivar properties: Defines the resource properties for the update. - :vartype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "VirtualMachineUpdateProperties"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - properties: Optional["_models.VirtualMachineUpdateProperties"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword properties: Defines the resource properties for the update. - :paramtype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.tags = tags - - -class VirtualmachinesPropertiesHardwareProfile(_serialization.Model): - """HardwareProfile - Specifies the hardware settings for the virtual machine. - - :ivar vm_size: - :vartype vm_size: str - :ivar processors: number of processors for the virtual machine. - :vartype processors: int - :ivar memory_gb: RAM in gb for the virtual machine. - :vartype memory_gb: int - :ivar dynamic_memory_config: - :vartype dynamic_memory_config: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig - """ - - _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "processors": {"key": "processors", "type": "int"}, - "memory_gb": {"key": "memoryGB", "type": "int"}, - "dynamic_memory_config": { - "key": "dynamicMemoryConfig", - "type": "VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig", - }, - } - - def __init__( - self, - *, - vm_size: Optional[str] = None, - processors: Optional[int] = None, - memory_gb: Optional[int] = None, - dynamic_memory_config: Optional["_models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig"] = None, - **kwargs - ): - """ - :keyword vm_size: - :paramtype vm_size: str - :keyword processors: number of processors for the virtual machine. - :paramtype processors: int - :keyword memory_gb: RAM in gb for the virtual machine. - :paramtype memory_gb: int - :keyword dynamic_memory_config: - :paramtype dynamic_memory_config: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.processors = processors - self.memory_gb = memory_gb - self.dynamic_memory_config = dynamic_memory_config - - -class VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig(_serialization.Model): - """VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig. - - :ivar maximum_memory_gb: - :vartype maximum_memory_gb: int - :ivar minimum_memory_gb: - :vartype minimum_memory_gb: int - :ivar target_memory_buffer: - :vartype target_memory_buffer: int - """ - - _attribute_map = { - "maximum_memory_gb": {"key": "maximumMemoryGB", "type": "int"}, - "minimum_memory_gb": {"key": "minimumMemoryGB", "type": "int"}, - "target_memory_buffer": {"key": "targetMemoryBuffer", "type": "int"}, - } - - def __init__( - self, - *, - maximum_memory_gb: Optional[int] = None, - minimum_memory_gb: Optional[int] = None, - target_memory_buffer: Optional[int] = None, - **kwargs - ): - """ - :keyword maximum_memory_gb: - :paramtype maximum_memory_gb: int - :keyword minimum_memory_gb: - :paramtype minimum_memory_gb: int - :keyword target_memory_buffer: - :paramtype target_memory_buffer: int - """ - super().__init__(**kwargs) - self.maximum_memory_gb = maximum_memory_gb - self.minimum_memory_gb = minimum_memory_gb - self.target_memory_buffer = target_memory_buffer - - -class VirtualmachinesPropertiesNetworkProfile(_serialization.Model): - """NetworkProfile - describes the network configuration the virtual machine. - - :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the - virtual machine. - :vartype network_interfaces: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] - """ - - _attribute_map = { - "network_interfaces": { - "key": "networkInterfaces", - "type": "[VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem]", - }, - } - - def __init__( - self, - *, - network_interfaces: Optional[ - List["_models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem"] - ] = None, - **kwargs - ): - """ - :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to - the virtual machine. - :paramtype network_interfaces: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] - """ - super().__init__(**kwargs) - self.network_interfaces = network_interfaces - - -class VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem(_serialization.Model): - """VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem. - - :ivar id: ID - Resource Id of the network interface. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: ID - Resource Id of the network interface. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class VirtualmachinesPropertiesOsProfile(_serialization.Model): - """OsProfile - describes the configuration of the operating system and sets login data. - - :ivar admin_password: AdminPassword - admin password. - :vartype admin_password: str - :ivar admin_username: AdminUsername - admin username. - :vartype admin_username: str - :ivar computer_name: ComputerName - name of the compute. - :vartype computer_name: str - :ivar linux_configuration: LinuxConfiguration - linux specific configuration values for the - virtual machine. - :vartype linux_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration - :ivar os_type: OsType - string specifying whether the OS is Linux or Windows. Known values are: - "Linux" and "Windows". - :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum - :ivar windows_configuration: Windows Configuration for the virtual machine. - :vartype windows_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration - """ - - _attribute_map = { - "admin_password": {"key": "adminPassword", "type": "str"}, - "admin_username": {"key": "adminUsername", "type": "str"}, - "computer_name": {"key": "computerName", "type": "str"}, - "linux_configuration": { - "key": "linuxConfiguration", - "type": "VirtualmachinesPropertiesOsProfileLinuxConfiguration", - }, - "os_type": {"key": "osType", "type": "str"}, - "windows_configuration": { - "key": "windowsConfiguration", - "type": "VirtualmachinesPropertiesOsProfileWindowsConfiguration", - }, - } - - def __init__( - self, - *, - admin_password: Optional[str] = None, - admin_username: Optional[str] = None, - computer_name: Optional[str] = None, - linux_configuration: Optional["_models.VirtualmachinesPropertiesOsProfileLinuxConfiguration"] = None, - os_type: Optional[Union[str, "_models.OsTypeEnum"]] = None, - windows_configuration: Optional["_models.VirtualmachinesPropertiesOsProfileWindowsConfiguration"] = None, - **kwargs - ): - """ - :keyword admin_password: AdminPassword - admin password. - :paramtype admin_password: str - :keyword admin_username: AdminUsername - admin username. - :paramtype admin_username: str - :keyword computer_name: ComputerName - name of the compute. - :paramtype computer_name: str - :keyword linux_configuration: LinuxConfiguration - linux specific configuration values for the - virtual machine. - :paramtype linux_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration - :keyword os_type: OsType - string specifying whether the OS is Linux or Windows. Known values - are: "Linux" and "Windows". - :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum - :keyword windows_configuration: Windows Configuration for the virtual machine. - :paramtype windows_configuration: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration - """ - super().__init__(**kwargs) - self.admin_password = admin_password - self.admin_username = admin_username - self.computer_name = computer_name - self.linux_configuration = linux_configuration - self.os_type = os_type - self.windows_configuration = windows_configuration - - -class VirtualmachinesPropertiesOsProfileLinuxConfiguration(_serialization.Model): - """LinuxConfiguration - linux specific configuration values for the virtual machine. - - :ivar disable_password_authentication: DisablePasswordAuthentication - whether password - authentication should be disabled. - :vartype disable_password_authentication: bool - :ivar ssh: SSH - contains settings related to ssh configuration. - :vartype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh - :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be - triggered during the virtual machine creation process. - :vartype provision_vm_agent: bool - """ - - _attribute_map = { - "disable_password_authentication": {"key": "disablePasswordAuthentication", "type": "bool"}, - "ssh": {"key": "ssh", "type": "VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh"}, - "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, - } - - def __init__( - self, - *, - disable_password_authentication: Optional[bool] = None, - ssh: Optional["_models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh"] = None, - provision_vm_agent: Optional[bool] = None, - **kwargs - ): - """ - :keyword disable_password_authentication: DisablePasswordAuthentication - whether password - authentication should be disabled. - :paramtype disable_password_authentication: bool - :keyword ssh: SSH - contains settings related to ssh configuration. - :paramtype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh - :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should - be triggered during the virtual machine creation process. - :paramtype provision_vm_agent: bool - """ - super().__init__(**kwargs) - self.disable_password_authentication = disable_password_authentication - self.ssh = ssh - self.provision_vm_agent = provision_vm_agent - - -class VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh(_serialization.Model): - """SSH - contains settings related to ssh configuration. - - :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :vartype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] - """ - - _attribute_map = { - "public_keys": { - "key": "publicKeys", - "type": "[VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem]", - }, - } - - def __init__( - self, - *, - public_keys: Optional[ - List["_models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem"] - ] = None, - **kwargs - ): - """ - :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :paramtype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem(_serialization.Model): - """VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem. - - :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through - ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For - creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure - `_. - :vartype key_data: str - :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If - the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :vartype path: str - """ - - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, key_data: Optional[str] = None, path: Optional[str] = None, **kwargs): - """ - :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM - through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. - :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li - nux VMs in Azure - `_. - :paramtype key_data: str - :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. - If the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :paramtype path: str - """ - super().__init__(**kwargs) - self.key_data = key_data - self.path = path - - -class VirtualmachinesPropertiesOsProfileWindowsConfiguration(_serialization.Model): - """Windows Configuration for the virtual machine. - - :ivar enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. - :vartype enable_automatic_updates: bool - :ivar ssh: SSH Configuration. - :vartype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh - :ivar time_zone: TimeZone for the virtual machine. - :vartype time_zone: str - :ivar provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should be - triggered during the virtual machine creation process. - :vartype provision_vm_agent: bool - """ - - _attribute_map = { - "enable_automatic_updates": {"key": "enableAutomaticUpdates", "type": "bool"}, - "ssh": {"key": "ssh", "type": "VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "provision_vm_agent": {"key": "provisionVMAgent", "type": "bool"}, - } - - def __init__( - self, - *, - enable_automatic_updates: Optional[bool] = None, - ssh: Optional["_models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh"] = None, - time_zone: Optional[str] = None, - provision_vm_agent: Optional[bool] = None, - **kwargs - ): - """ - :keyword enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. - :paramtype enable_automatic_updates: bool - :keyword ssh: SSH Configuration. - :paramtype ssh: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh - :keyword time_zone: TimeZone for the virtual machine. - :paramtype time_zone: str - :keyword provision_vm_agent: Used to indicate whether Arc for Servers agent onboarding should - be triggered during the virtual machine creation process. - :paramtype provision_vm_agent: bool - """ - super().__init__(**kwargs) - self.enable_automatic_updates = enable_automatic_updates - self.ssh = ssh - self.time_zone = time_zone - self.provision_vm_agent = provision_vm_agent - - -class VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh(_serialization.Model): - """SSH Configuration. - - :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :vartype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] - """ - - _attribute_map = { - "public_keys": { - "key": "publicKeys", - "type": "[VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem]", - }, - } - - def __init__( - self, - *, - public_keys: Optional[ - List["_models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem"] - ] = None, - **kwargs - ): - """ - :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux - based VMs. - :paramtype public_keys: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem(_serialization.Model): - """VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem. - - :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through - ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For - creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure - `_. - :vartype key_data: str - :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If - the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :vartype path: str - """ - - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, key_data: Optional[str] = None, path: Optional[str] = None, **kwargs): - """ - :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM - through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. - :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li - nux VMs in Azure - `_. - :paramtype key_data: str - :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. - If the file already exists, the specified key is appended to the file. Example: - /home/user/.ssh/authorized_keys. - :paramtype path: str - """ - super().__init__(**kwargs) - self.key_data = key_data - self.path = path - - -class VirtualmachinesPropertiesSecurityProfile(_serialization.Model): - """SecurityProfile - Specifies the security settings for the virtual machine. - - :ivar enable_tpm: - :vartype enable_tpm: bool - :ivar uefi_settings: - :vartype uefi_settings: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfileUefiSettings - """ - - _attribute_map = { - "enable_tpm": {"key": "enableTPM", "type": "bool"}, - "uefi_settings": {"key": "uefiSettings", "type": "VirtualmachinesPropertiesSecurityProfileUefiSettings"}, + "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, *, - enable_tpm: Optional[bool] = None, - uefi_settings: Optional["_models.VirtualmachinesPropertiesSecurityProfileUefiSettings"] = None, - **kwargs - ): - """ - :keyword enable_tpm: - :paramtype enable_tpm: bool - :keyword uefi_settings: - :paramtype uefi_settings: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfileUefiSettings - """ - super().__init__(**kwargs) - self.enable_tpm = enable_tpm - self.uefi_settings = uefi_settings - - -class VirtualmachinesPropertiesSecurityProfileUefiSettings(_serialization.Model): - """VirtualmachinesPropertiesSecurityProfileUefiSettings. - - :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. - :vartype secure_boot_enabled: bool - """ - - _attribute_map = { - "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, - } - - def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs): + 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 secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual - machine. - :paramtype secure_boot_enabled: bool + :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.azurestackhci.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.azurestackhci.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) - self.secure_boot_enabled = secure_boot_enabled - - -class VirtualmachinesPropertiesStorageProfile(_serialization.Model): - """StorageProfile - contains information about the disks and storage information for the virtual machine. - - :ivar data_disks: adds data disks to the virtual machine. - :vartype data_disks: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] - :ivar image_reference: Which Image to use for the virtual machine. - :vartype image_reference: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference - :ivar os_disk: VHD to attach as OS disk. - :vartype os_disk: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileOsDisk - :ivar vm_config_container_name: Name of the storage container that hosts the VM configuration - file. - :vartype vm_config_container_name: str - """ - - _attribute_map = { - "data_disks": {"key": "dataDisks", "type": "[VirtualmachinesPropertiesStorageProfileDataDisksItem]"}, - "image_reference": {"key": "imageReference", "type": "VirtualmachinesPropertiesStorageProfileImageReference"}, - "os_disk": {"key": "osDisk", "type": "VirtualmachinesPropertiesStorageProfileOsDisk"}, - "vm_config_container_name": {"key": "vmConfigContainerName", "type": "str"}, - } + 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 - def __init__( - self, - *, - data_disks: Optional[List["_models.VirtualmachinesPropertiesStorageProfileDataDisksItem"]] = None, - image_reference: Optional["_models.VirtualmachinesPropertiesStorageProfileImageReference"] = None, - os_disk: Optional["_models.VirtualmachinesPropertiesStorageProfileOsDisk"] = None, - vm_config_container_name: Optional[str] = None, - **kwargs - ): - """ - :keyword data_disks: adds data disks to the virtual machine. - :paramtype data_disks: - list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] - :keyword image_reference: Which Image to use for the virtual machine. - :paramtype image_reference: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference - :keyword os_disk: VHD to attach as OS disk. - :paramtype os_disk: - ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileOsDisk - :keyword vm_config_container_name: Name of the storage container that hosts the VM - configuration file. - :paramtype vm_config_container_name: str - """ - super().__init__(**kwargs) - self.data_disks = data_disks - self.image_reference = image_reference - self.os_disk = os_disk - self.vm_config_container_name = vm_config_container_name +class Update(ProxyResource): # pylint: disable=too-many-instance-attributes + """Update details. -class VirtualmachinesPropertiesStorageProfileDataDisksItem(_serialization.Model): - """VirtualmachinesPropertiesStorageProfileDataDisksItem. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: + :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.azurestackhci.models.SystemData + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: Provisioning state of the Updates proxy resource. Known values are: + "NotSpecified", "Error", "Succeeded", "Failed", "Canceled", "Connected", "Disconnected", + "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState + :ivar installed_date: Date that the update was installed. + :vartype installed_date: ~datetime.datetime + :ivar description: Description of the update. + :vartype description: str + :ivar state: State of the update as it relates to this stamp. Known values are: + "HasPrerequisite", "Obsolete", "Ready", "NotApplicableBecauseAnotherUpdateIsInProgress", + "Preparing", "Installing", "Installed", "PreparationFailed", "InstallationFailed", "Invalid", + "Recalled", "Downloading", "DownloadFailed", "HealthChecking", "HealthCheckFailed", + "ReadyToInstall", "ScanInProgress", and "ScanFailed". + :vartype state: str or ~azure.mgmt.azurestackhci.models.State + :ivar prerequisites: If update State is HasPrerequisite, this property contains an array of + objects describing prerequisite updates before installing this update. Otherwise, it is empty. + :vartype prerequisites: list[~azure.mgmt.azurestackhci.models.UpdatePrerequisite] + :ivar component_versions: An array of component versions for a Solution Bundle update, and an + empty array otherwise. + :vartype component_versions: list[~azure.mgmt.azurestackhci.models.PackageVersionInfo] + :ivar reboot_required: Known values are: "Unknown", "True", and "False". + :vartype reboot_required: str or ~azure.mgmt.azurestackhci.models.RebootRequirement + :ivar health_state: Overall health state for update-specific health checks. Known values are: + "Unknown", "Success", "Failure", "Warning", "Error", and "InProgress". + :vartype health_state: str or ~azure.mgmt.azurestackhci.models.HealthState + :ivar health_check_result: An array of PrecheckResult objects. + :vartype health_check_result: list[~azure.mgmt.azurestackhci.models.PrecheckResult] + :ivar health_check_date: Last time the package-specific checks were run. + :vartype health_check_date: ~datetime.datetime + :ivar package_path: Path where the update package is available. + :vartype package_path: str + :ivar package_size_in_mb: Size of the package. This value is a combination of the size from + update metadata and size of the payload that results from the live scan operation for OS update + content. + :vartype package_size_in_mb: float + :ivar display_name: Display name of the Update. + :vartype display_name: str + :ivar version: Version of the update. + :vartype version: str + :ivar publisher: Publisher of the update package. + :vartype publisher: str + :ivar release_link: Link to release notes for the update. + :vartype release_link: str + :ivar availability_type: Indicates the way the update content can be downloaded. Known values + are: "Local", "Online", and "Notify". + :vartype availability_type: str or ~azure.mgmt.azurestackhci.models.AvailabilityType + :ivar package_type: Customer-visible type of the update. + :vartype package_type: str + :ivar additional_properties: Extensible KV pairs serialized as a string. This is currently used + to report the stamp OEM family and hardware model information when an update is flagged as + Invalid for the stamp based on OEM type. + :vartype additional_properties: str + :ivar progress_percentage: Progress percentage of ongoing operation. Currently this property is + only valid when the update is in the Downloading state, where it maps to how much of the update + content has been downloaded. + :vartype progress_percentage: float + :ivar notify_message: Brief message with instructions for updates of AvailabilityType Notify. + :vartype notify_message: str """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): - """ - :keyword name: - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class VirtualmachinesPropertiesStorageProfileImageReference(_serialization.Model): - """Which Image to use for the virtual machine. - - :ivar name: Name - Name of the image. - :vartype name: str - """ - _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "installed_date": {"key": "properties.installedDate", "type": "iso-8601"}, + "description": {"key": "properties.description", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "prerequisites": {"key": "properties.prerequisites", "type": "[UpdatePrerequisite]"}, + "component_versions": {"key": "properties.componentVersions", "type": "[PackageVersionInfo]"}, + "reboot_required": {"key": "properties.rebootRequired", "type": "str"}, + "health_state": {"key": "properties.healthState", "type": "str"}, + "health_check_result": {"key": "properties.healthCheckResult", "type": "[PrecheckResult]"}, + "health_check_date": {"key": "properties.healthCheckDate", "type": "iso-8601"}, + "package_path": {"key": "properties.packagePath", "type": "str"}, + "package_size_in_mb": {"key": "properties.packageSizeInMb", "type": "float"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + "release_link": {"key": "properties.releaseLink", "type": "str"}, + "availability_type": {"key": "properties.availabilityType", "type": "str"}, + "package_type": {"key": "properties.packageType", "type": "str"}, + "additional_properties": {"key": "properties.additionalProperties", "type": "str"}, + "progress_percentage": {"key": "properties.updateStateProperties.progressPercentage", "type": "float"}, + "notify_message": {"key": "properties.updateStateProperties.notifyMessage", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, **kwargs): + def __init__( # pylint: disable=too-many-locals + self, + *, + location: Optional[str] = None, + installed_date: Optional[datetime.datetime] = None, + description: Optional[str] = None, + state: Optional[Union[str, "_models.State"]] = None, + prerequisites: Optional[List["_models.UpdatePrerequisite"]] = None, + component_versions: Optional[List["_models.PackageVersionInfo"]] = None, + reboot_required: Optional[Union[str, "_models.RebootRequirement"]] = None, + health_state: Optional[Union[str, "_models.HealthState"]] = None, + health_check_result: Optional[List["_models.PrecheckResult"]] = None, + health_check_date: Optional[datetime.datetime] = None, + package_path: Optional[str] = None, + package_size_in_mb: Optional[float] = None, + display_name: Optional[str] = None, + version: Optional[str] = None, + publisher: Optional[str] = None, + release_link: Optional[str] = None, + availability_type: Optional[Union[str, "_models.AvailabilityType"]] = None, + package_type: Optional[str] = None, + additional_properties: Optional[str] = None, + progress_percentage: Optional[float] = None, + notify_message: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Name - Name of the image. - :paramtype name: str + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword installed_date: Date that the update was installed. + :paramtype installed_date: ~datetime.datetime + :keyword description: Description of the update. + :paramtype description: str + :keyword state: State of the update as it relates to this stamp. Known values are: + "HasPrerequisite", "Obsolete", "Ready", "NotApplicableBecauseAnotherUpdateIsInProgress", + "Preparing", "Installing", "Installed", "PreparationFailed", "InstallationFailed", "Invalid", + "Recalled", "Downloading", "DownloadFailed", "HealthChecking", "HealthCheckFailed", + "ReadyToInstall", "ScanInProgress", and "ScanFailed". + :paramtype state: str or ~azure.mgmt.azurestackhci.models.State + :keyword prerequisites: If update State is HasPrerequisite, this property contains an array of + objects describing prerequisite updates before installing this update. Otherwise, it is empty. + :paramtype prerequisites: list[~azure.mgmt.azurestackhci.models.UpdatePrerequisite] + :keyword component_versions: An array of component versions for a Solution Bundle update, and + an empty array otherwise. + :paramtype component_versions: list[~azure.mgmt.azurestackhci.models.PackageVersionInfo] + :keyword reboot_required: Known values are: "Unknown", "True", and "False". + :paramtype reboot_required: str or ~azure.mgmt.azurestackhci.models.RebootRequirement + :keyword health_state: Overall health state for update-specific health checks. Known values + are: "Unknown", "Success", "Failure", "Warning", "Error", and "InProgress". + :paramtype health_state: str or ~azure.mgmt.azurestackhci.models.HealthState + :keyword health_check_result: An array of PrecheckResult objects. + :paramtype health_check_result: list[~azure.mgmt.azurestackhci.models.PrecheckResult] + :keyword health_check_date: Last time the package-specific checks were run. + :paramtype health_check_date: ~datetime.datetime + :keyword package_path: Path where the update package is available. + :paramtype package_path: str + :keyword package_size_in_mb: Size of the package. This value is a combination of the size from + update metadata and size of the payload that results from the live scan operation for OS update + content. + :paramtype package_size_in_mb: float + :keyword display_name: Display name of the Update. + :paramtype display_name: str + :keyword version: Version of the update. + :paramtype version: str + :keyword publisher: Publisher of the update package. + :paramtype publisher: str + :keyword release_link: Link to release notes for the update. + :paramtype release_link: str + :keyword availability_type: Indicates the way the update content can be downloaded. Known + values are: "Local", "Online", and "Notify". + :paramtype availability_type: str or ~azure.mgmt.azurestackhci.models.AvailabilityType + :keyword package_type: Customer-visible type of the update. + :paramtype package_type: str + :keyword additional_properties: Extensible KV pairs serialized as a string. This is currently + used to report the stamp OEM family and hardware model information when an update is flagged as + Invalid for the stamp based on OEM type. + :paramtype additional_properties: str + :keyword progress_percentage: Progress percentage of ongoing operation. Currently this property + is only valid when the update is in the Downloading state, where it maps to how much of the + update content has been downloaded. + :paramtype progress_percentage: float + :keyword notify_message: Brief message with instructions for updates of AvailabilityType + Notify. + :paramtype notify_message: str """ super().__init__(**kwargs) - self.name = name - - -class VirtualmachinesPropertiesStorageProfileOsDisk(_serialization.Model): - """VHD to attach as OS disk. - - :ivar id: Specifies the virtual hard disk's ID. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } + self.location = location + self.provisioning_state = None + self.installed_date = installed_date + self.description = description + self.state = state + self.prerequisites = prerequisites + self.component_versions = component_versions + self.reboot_required = reboot_required + self.health_state = health_state + self.health_check_result = health_check_result + self.health_check_date = health_check_date + self.package_path = package_path + self.package_size_in_mb = package_size_in_mb + self.display_name = display_name + self.version = version + self.publisher = publisher + self.release_link = release_link + self.availability_type = availability_type + self.package_type = package_type + self.additional_properties = additional_properties + self.progress_percentage = progress_percentage + self.notify_message = notify_message - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Specifies the virtual hard disk's ID. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id +class UpdateList(_serialization.Model): + """List of Updates. -class VirtualMachineStatus(_serialization.Model): - """VirtualMachineStatus defines the observed state of virtualmachines. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: VirtualMachine provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar power_state: The power state of the virtual machine. Known values are: "Deallocated", - "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". - :vartype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum - :ivar provisioning_status: The provisioning status of the virtual machine. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualMachineStatusProvisioningStatus + :ivar value: List of Updates. + :vartype value: list[~azure.mgmt.azurestackhci.models.Update] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ - _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "power_state": {"key": "powerState", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "VirtualMachineStatusProvisioningStatus"}, + _validation = { + "next_link": {"readonly": True}, } - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - power_state: Optional[Union[str, "_models.PowerStateEnum"]] = None, - provisioning_status: Optional["_models.VirtualMachineStatusProvisioningStatus"] = None, - **kwargs - ): - """ - :keyword error_code: VirtualMachine provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword power_state: The power state of the virtual machine. Known values are: "Deallocated", - "Deallocating", "Running", "Starting", "Stopped", "Stopping", and "Unknown". - :paramtype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum - :keyword provisioning_status: The provisioning status of the virtual machine. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualMachineStatusProvisioningStatus - """ - super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.power_state = power_state - self.provisioning_status = provisioning_status - - -class VirtualMachineStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual machine. - - :ivar operation_id: The ID of the operation performed on the virtual machine. - :vartype operation_id: str - :ivar status: The status of the operation performed on the virtual machine [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "value": {"key": "value", "type": "[Update]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Update"]] = None, **kwargs: Any) -> None: """ - :keyword operation_id: The ID of the operation performed on the virtual machine. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the virtual machine [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :keyword value: List of Updates. + :paramtype value: list[~azure.mgmt.azurestackhci.models.Update] """ super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status + self.value = value + self.next_link = None -class VirtualMachineUpdateProperties(_serialization.Model): - """Defines the resource properties for the update. +class UpdatePrerequisite(_serialization.Model): + """If update State is HasPrerequisite, this property contains an array of objects describing + prerequisite updates before installing this update. Otherwise, it is empty. - :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. - :vartype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate - :ivar storage_profile: - :vartype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate - :ivar network_profile: NetworkProfile - describes the network update configuration the virtual - machine. - :vartype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + :ivar update_type: Updatable component type. + :vartype update_type: str + :ivar version: Version of the prerequisite. + :vartype version: str + :ivar package_name: Friendly name of the prerequisite. + :vartype package_name: str """ _attribute_map = { - "hardware_profile": {"key": "hardwareProfile", "type": "HardwareProfileUpdate"}, - "storage_profile": {"key": "storageProfile", "type": "StorageProfileUpdate"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfileUpdate"}, + "update_type": {"key": "updateType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, } def __init__( self, *, - hardware_profile: Optional["_models.HardwareProfileUpdate"] = None, - storage_profile: Optional["_models.StorageProfileUpdate"] = None, - network_profile: Optional["_models.NetworkProfileUpdate"] = None, - **kwargs - ): + update_type: Optional[str] = None, + version: Optional[str] = None, + package_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual - machine. - :paramtype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate - :keyword storage_profile: - :paramtype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate - :keyword network_profile: NetworkProfile - describes the network update configuration the - virtual machine. - :paramtype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + :keyword update_type: Updatable component type. + :paramtype update_type: str + :keyword version: Version of the prerequisite. + :paramtype version: str + :keyword package_name: Friendly name of the prerequisite. + :paramtype package_name: str """ super().__init__(**kwargs) - self.hardware_profile = hardware_profile - self.storage_profile = storage_profile - self.network_profile = network_profile + self.update_type = update_type + self.version = version + self.package_name = package_name -class Virtualnetworks(TrackedResource): # pylint: disable=too-many-instance-attributes - """The virtual network resource definition. +class UpdateRun(ProxyResource): # pylint: disable=too-many-instance-attributes + """Details of an Update run. 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 Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -4853,344 +2716,374 @@ class Virtualnetworks(TrackedResource): # pylint: disable=too-many-instance-att :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 extended_location: The extendedLocation of the resource. - :vartype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData - :ivar network_type: Type of the network. Known values are: "NAT", "Transparent", "L2Bridge", - "L2Tunnel", "ICS", "Private", "Overlay", "Internal", and "Mirrored". - :vartype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum - :ivar subnets: Subnet - list of subnets under the virtual network. - :vartype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] - :ivar provisioning_state: Provisioning state of the gallery image. Known values are: - "Succeeded", "Failed", "InProgress", "Accepted", "Deleting", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum - :ivar resource_name: name of the object to be used in moc. - :vartype resource_name: str - :ivar status: VirtualNetworkStatus defines the observed state of virtual networks. - :vartype status: ~azure.mgmt.azurestackhci.models.VirtualNetworkStatus + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: Provisioning state of the UpdateRuns proxy resource. Known values + are: "NotSpecified", "Error", "Succeeded", "Failed", "Canceled", "Connected", "Disconnected", + "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState + :ivar time_started: Timestamp of the update run was started. + :vartype time_started: ~datetime.datetime + :ivar last_updated_time: Timestamp of the most recently completed step in the update run. + :vartype last_updated_time: ~datetime.datetime + :ivar duration: Duration of the update run. + :vartype duration: str + :ivar state: State of the update run. Known values are: "Unknown", "Succeeded", "InProgress", + and "Failed". + :vartype state: str or ~azure.mgmt.azurestackhci.models.UpdateRunPropertiesState + :ivar name_properties_progress_name: Name of the step. + :vartype name_properties_progress_name: str + :ivar description: More detailed description of the step. + :vartype description: str + :ivar error_message: Error message, specified if the step is in a failed state. + :vartype error_message: str + :ivar status: Status of the step, bubbled up from the ECE action plan for installation + attempts. Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'. + :vartype status: str + :ivar start_time_utc: When the step started, or empty if it has not started executing. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: When the step reached a terminal state. + :vartype end_time_utc: ~datetime.datetime + :ivar last_updated_time_utc: Completion time of this step or the last completed sub-step. + :vartype last_updated_time_utc: ~datetime.datetime + :ivar steps: Recursive model for child steps of this step. + :vartype steps: list[~azure.mgmt.azurestackhci.models.Step] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, - "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"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "network_type": {"key": "properties.networkType", "type": "str"}, - "subnets": {"key": "properties.subnets", "type": "[VirtualnetworksPropertiesSubnetsItem]"}, + "location": {"key": "location", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "resource_name": {"key": "properties.resourceName", "type": "str"}, - "status": {"key": "properties.status", "type": "VirtualNetworkStatus"}, + "time_started": {"key": "properties.timeStarted", "type": "iso-8601"}, + "last_updated_time": {"key": "properties.lastUpdatedTime", "type": "iso-8601"}, + "duration": {"key": "properties.duration", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "name_properties_progress_name": {"key": "properties.progress.name", "type": "str"}, + "description": {"key": "properties.progress.description", "type": "str"}, + "error_message": {"key": "properties.progress.errorMessage", "type": "str"}, + "status": {"key": "properties.progress.status", "type": "str"}, + "start_time_utc": {"key": "properties.progress.startTimeUtc", "type": "iso-8601"}, + "end_time_utc": {"key": "properties.progress.endTimeUtc", "type": "iso-8601"}, + "last_updated_time_utc": {"key": "properties.progress.lastUpdatedTimeUtc", "type": "iso-8601"}, + "steps": {"key": "properties.progress.steps", "type": "[Step]"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, - network_type: Optional[Union[str, "_models.NetworkTypeEnum"]] = None, - subnets: Optional[List["_models.VirtualnetworksPropertiesSubnetsItem"]] = None, - resource_name: Optional[str] = None, - **kwargs - ): + location: Optional[str] = None, + time_started: Optional[datetime.datetime] = None, + last_updated_time: Optional[datetime.datetime] = None, + duration: Optional[str] = None, + state: Optional[Union[str, "_models.UpdateRunPropertiesState"]] = None, + name_properties_progress_name: Optional[str] = None, + description: Optional[str] = None, + error_message: Optional[str] = None, + status: Optional[str] = None, + start_time_utc: Optional[datetime.datetime] = None, + end_time_utc: Optional[datetime.datetime] = None, + last_updated_time_utc: Optional[datetime.datetime] = None, + steps: Optional[List["_models.Step"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. + :keyword location: The geo-location where the resource lives. :paramtype location: str - :keyword extended_location: The extendedLocation of the resource. - :paramtype extended_location: ~azure.mgmt.azurestackhci.models.ExtendedLocation - :keyword network_type: Type of the network. Known values are: "NAT", "Transparent", "L2Bridge", - "L2Tunnel", "ICS", "Private", "Overlay", "Internal", and "Mirrored". - :paramtype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum - :keyword subnets: Subnet - list of subnets under the virtual network. - :paramtype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] - :keyword resource_name: name of the object to be used in moc. - :paramtype resource_name: str + :keyword time_started: Timestamp of the update run was started. + :paramtype time_started: ~datetime.datetime + :keyword last_updated_time: Timestamp of the most recently completed step in the update run. + :paramtype last_updated_time: ~datetime.datetime + :keyword duration: Duration of the update run. + :paramtype duration: str + :keyword state: State of the update run. Known values are: "Unknown", "Succeeded", + "InProgress", and "Failed". + :paramtype state: str or ~azure.mgmt.azurestackhci.models.UpdateRunPropertiesState + :keyword name_properties_progress_name: Name of the step. + :paramtype name_properties_progress_name: str + :keyword description: More detailed description of the step. + :paramtype description: str + :keyword error_message: Error message, specified if the step is in a failed state. + :paramtype error_message: str + :keyword status: Status of the step, bubbled up from the ECE action plan for installation + attempts. Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'. + :paramtype status: str + :keyword start_time_utc: When the step started, or empty if it has not started executing. + :paramtype start_time_utc: ~datetime.datetime + :keyword end_time_utc: When the step reached a terminal state. + :paramtype end_time_utc: ~datetime.datetime + :keyword last_updated_time_utc: Completion time of this step or the last completed sub-step. + :paramtype last_updated_time_utc: ~datetime.datetime + :keyword steps: Recursive model for child steps of this step. + :paramtype steps: list[~azure.mgmt.azurestackhci.models.Step] """ - super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location - self.system_data = None - self.network_type = network_type - self.subnets = subnets + super().__init__(**kwargs) + self.location = location self.provisioning_state = None - self.resource_name = resource_name - self.status = None + self.time_started = time_started + self.last_updated_time = last_updated_time + self.duration = duration + self.state = state + self.name_properties_progress_name = name_properties_progress_name + self.description = description + self.error_message = error_message + self.status = status + self.start_time_utc = start_time_utc + self.end_time_utc = end_time_utc + self.last_updated_time_utc = last_updated_time_utc + self.steps = steps + +class UpdateRunList(_serialization.Model): + """List of Update runs. -class VirtualnetworksListResult(_serialization.Model): - """VirtualnetworksListResult. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: - :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :ivar next_link: + :ivar value: List of Update runs. + :vartype value: list[~azure.mgmt.azurestackhci.models.UpdateRun] + :ivar next_link: Link to the next set of results. :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[Virtualnetworks]"}, + "value": {"key": "value", "type": "[UpdateRun]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, value: Optional[List["_models.Virtualnetworks"]] = None, next_link: Optional[str] = None, **kwargs - ): + def __init__(self, *, value: Optional[List["_models.UpdateRun"]] = None, **kwargs: Any) -> None: """ - :keyword value: - :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :keyword next_link: - :paramtype next_link: str + :keyword value: List of Update runs. + :paramtype value: list[~azure.mgmt.azurestackhci.models.UpdateRun] """ super().__init__(**kwargs) self.value = value - self.next_link = next_link - - -class VirtualnetworksPatch(_serialization.Model): - """The virtual network resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } + self.next_link = None - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags +class UpdateSummaries(ProxyResource): # pylint: disable=too-many-instance-attributes + """Get the update summaries for the cluster. -class VirtualnetworksPropertiesSubnetsItem(_serialization.Model): - """Subnet subnet in a virtual network resource. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name - The name of the resource that is unique within a resource group. This name - can be used to access the 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 address_prefix: Cidr for this subnet - IPv4, IPv6. - :vartype address_prefix: str - :ivar address_prefixes: AddressPrefixes - List of address prefixes for the subnet. - :vartype address_prefixes: list[str] - :ivar ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible - values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". - :vartype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum - :ivar ip_configuration_references: IPConfigurationReferences - list of - IPConfigurationReferences. - :vartype ip_configuration_references: - list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] - :ivar route_table: RouteTable for the subnet. - :vartype route_table: - ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable - :ivar ip_pools: network associated pool of IP Addresses. - :vartype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] - :ivar vlan: Vlan to use for the subnet. - :vartype vlan: int + :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.azurestackhci.models.SystemData + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: Provisioning state of the UpdateSummaries proxy resource. Known + values are: "NotSpecified", "Error", "Succeeded", "Failed", "Canceled", "Connected", + "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", "PartiallySucceeded", + "PartiallyConnected", "InProgress", "Accepted", "Provisioning", and "DisableInProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningState + :ivar oem_family: OEM family name. + :vartype oem_family: str + :ivar hardware_model: Name of the hardware model. + :vartype hardware_model: str + :ivar package_versions: Current version of each updatable component. + :vartype package_versions: list[~azure.mgmt.azurestackhci.models.PackageVersionInfo] + :ivar current_version: Current Solution Bundle version of the stamp. + :vartype current_version: str + :ivar last_updated: Last time an update installation completed successfully. + :vartype last_updated: ~datetime.datetime + :ivar last_checked: Last time the update service successfully checked for updates. + :vartype last_checked: ~datetime.datetime + :ivar health_state: Overall health state for update-specific health checks. Known values are: + "Unknown", "Success", "Failure", "Warning", "Error", and "InProgress". + :vartype health_state: str or ~azure.mgmt.azurestackhci.models.HealthState + :ivar health_check_result: An array of pre-check result objects. + :vartype health_check_result: list[~azure.mgmt.azurestackhci.models.PrecheckResult] + :ivar health_check_date: Last time the package-specific checks were run. + :vartype health_check_date: ~datetime.datetime + :ivar state: Overall update state of the stamp. Known values are: "Unknown", + "AppliedSuccessfully", "UpdateAvailable", "UpdateInProgress", "UpdateFailed", "NeedsAttention", + "PreparationInProgress", and "PreparationFailed". + :vartype state: str or ~azure.mgmt.azurestackhci.models.UpdateSummariesPropertiesState """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, - "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, - "ip_allocation_method": {"key": "properties.ipAllocationMethod", "type": "str"}, - "ip_configuration_references": { - "key": "properties.ipConfigurationReferences", - "type": "[ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems]", - }, - "route_table": { - "key": "properties.routeTable", - "type": "ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable", - }, - "ip_pools": {"key": "properties.ipPools", "type": "[IPPool]"}, - "vlan": {"key": "properties.vlan", "type": "int"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "oem_family": {"key": "properties.oemFamily", "type": "str"}, + "hardware_model": {"key": "properties.hardwareModel", "type": "str"}, + "package_versions": {"key": "properties.packageVersions", "type": "[PackageVersionInfo]"}, + "current_version": {"key": "properties.currentVersion", "type": "str"}, + "last_updated": {"key": "properties.lastUpdated", "type": "iso-8601"}, + "last_checked": {"key": "properties.lastChecked", "type": "iso-8601"}, + "health_state": {"key": "properties.healthState", "type": "str"}, + "health_check_result": {"key": "properties.healthCheckResult", "type": "[PrecheckResult]"}, + "health_check_date": {"key": "properties.healthCheckDate", "type": "iso-8601"}, + "state": {"key": "properties.state", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - address_prefix: Optional[str] = None, - address_prefixes: Optional[List[str]] = None, - ip_allocation_method: Optional[Union[str, "_models.IpAllocationMethodEnum"]] = None, - ip_configuration_references: Optional[ - List[ - "_models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems" - ] - ] = None, - route_table: Optional[ - "_models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable" - ] = None, - ip_pools: Optional[List["_models.IPPool"]] = None, - vlan: Optional[int] = None, - **kwargs - ): + location: Optional[str] = None, + oem_family: Optional[str] = None, + hardware_model: Optional[str] = None, + package_versions: Optional[List["_models.PackageVersionInfo"]] = None, + current_version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + last_checked: Optional[datetime.datetime] = None, + health_state: Optional[Union[str, "_models.HealthState"]] = None, + health_check_result: Optional[List["_models.PrecheckResult"]] = None, + health_check_date: Optional[datetime.datetime] = None, + state: Optional[Union[str, "_models.UpdateSummariesPropertiesState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Name - The name of the resource that is unique within a resource group. This - name can be used to access the resource. - :paramtype name: str - :keyword address_prefix: Cidr for this subnet - IPv4, IPv6. - :paramtype address_prefix: str - :keyword address_prefixes: AddressPrefixes - List of address prefixes for the subnet. - :paramtype address_prefixes: list[str] - :keyword ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible - values include: 'Static', 'Dynamic'. Known values are: "Dynamic" and "Static". - :paramtype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum - :keyword ip_configuration_references: IPConfigurationReferences - list of - IPConfigurationReferences. - :paramtype ip_configuration_references: - list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] - :keyword route_table: RouteTable for the subnet. - :paramtype route_table: - ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable - :keyword ip_pools: network associated pool of IP Addresses. - :paramtype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] - :keyword vlan: Vlan to use for the subnet. - :paramtype vlan: int + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword oem_family: OEM family name. + :paramtype oem_family: str + :keyword hardware_model: Name of the hardware model. + :paramtype hardware_model: str + :keyword package_versions: Current version of each updatable component. + :paramtype package_versions: list[~azure.mgmt.azurestackhci.models.PackageVersionInfo] + :keyword current_version: Current Solution Bundle version of the stamp. + :paramtype current_version: str + :keyword last_updated: Last time an update installation completed successfully. + :paramtype last_updated: ~datetime.datetime + :keyword last_checked: Last time the update service successfully checked for updates. + :paramtype last_checked: ~datetime.datetime + :keyword health_state: Overall health state for update-specific health checks. Known values + are: "Unknown", "Success", "Failure", "Warning", "Error", and "InProgress". + :paramtype health_state: str or ~azure.mgmt.azurestackhci.models.HealthState + :keyword health_check_result: An array of pre-check result objects. + :paramtype health_check_result: list[~azure.mgmt.azurestackhci.models.PrecheckResult] + :keyword health_check_date: Last time the package-specific checks were run. + :paramtype health_check_date: ~datetime.datetime + :keyword state: Overall update state of the stamp. Known values are: "Unknown", + "AppliedSuccessfully", "UpdateAvailable", "UpdateInProgress", "UpdateFailed", "NeedsAttention", + "PreparationInProgress", and "PreparationFailed". + :paramtype state: str or ~azure.mgmt.azurestackhci.models.UpdateSummariesPropertiesState """ super().__init__(**kwargs) - self.name = name - self.address_prefix = address_prefix - self.address_prefixes = address_prefixes - self.ip_allocation_method = ip_allocation_method - self.ip_configuration_references = ip_configuration_references - self.route_table = route_table - self.ip_pools = ip_pools - self.vlan = vlan + self.location = location + self.provisioning_state = None + self.oem_family = oem_family + self.hardware_model = hardware_model + self.package_versions = package_versions + self.current_version = current_version + self.last_updated = last_updated + self.last_checked = last_checked + self.health_state = health_state + self.health_check_result = health_check_result + self.health_check_date = health_check_date + self.state = state -class VirtualnetworksPropertiesSubnetsPropertiesItemsItem(_serialization.Model): - """Route is associated with a subnet. +class UpdateSummariesList(_serialization.Model): + """List of Update Summaries. - :ivar name: Name - name of the subnet. - :vartype name: str - :ivar address_prefix: AddressPrefix - The destination CIDR to which the route applies. - :vartype address_prefix: str - :ivar next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. - Next hop values are only allowed in routes where the next hop type is VirtualAppliance. - :vartype next_hop_ip_address: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Update Summaries. + :vartype value: list[~azure.mgmt.azurestackhci.models.UpdateSummaries] + :ivar next_link: Link to the next set of results. + :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "address_prefix": {"key": "properties.addressPrefix", "type": "str"}, - "next_hop_ip_address": {"key": "properties.nextHopIpAddress", "type": "str"}, + "value": {"key": "value", "type": "[UpdateSummaries]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - address_prefix: Optional[str] = None, - next_hop_ip_address: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.UpdateSummaries"]] = None, **kwargs: Any) -> None: """ - :keyword name: Name - name of the subnet. - :paramtype name: str - :keyword address_prefix: AddressPrefix - The destination CIDR to which the route applies. - :paramtype address_prefix: str - :keyword next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. - Next hop values are only allowed in routes where the next hop type is VirtualAppliance. - :paramtype next_hop_ip_address: str + :keyword value: List of Update Summaries. + :paramtype value: list[~azure.mgmt.azurestackhci.models.UpdateSummaries] """ super().__init__(**kwargs) - self.name = name - self.address_prefix = address_prefix - self.next_hop_ip_address = next_hop_ip_address + self.value = value + self.next_link = None -class VirtualNetworkStatus(_serialization.Model): - """VirtualNetworkStatus defines the observed state of virtual networks. +class UploadCertificateRequest(_serialization.Model): + """UploadCertificateRequest. - :ivar error_code: VirtualNetwork provisioning error code. - :vartype error_code: str - :ivar error_message: Descriptive error message. - :vartype error_message: str - :ivar provisioning_status: The provisioning status of the virtual network. - :vartype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualNetworkStatusProvisioningStatus + :ivar properties: + :vartype properties: ~azure.mgmt.azurestackhci.models.RawCertificateData """ _attribute_map = { - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "VirtualNetworkStatusProvisioningStatus"}, + "properties": {"key": "properties", "type": "RawCertificateData"}, } - def __init__( - self, - *, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.VirtualNetworkStatusProvisioningStatus"] = None, - **kwargs - ): + def __init__(self, *, properties: Optional["_models.RawCertificateData"] = None, **kwargs: Any) -> None: """ - :keyword error_code: VirtualNetwork provisioning error code. - :paramtype error_code: str - :keyword error_message: Descriptive error message. - :paramtype error_message: str - :keyword provisioning_status: The provisioning status of the virtual network. - :paramtype provisioning_status: - ~azure.mgmt.azurestackhci.models.VirtualNetworkStatusProvisioningStatus + :keyword properties: + :paramtype properties: ~azure.mgmt.azurestackhci.models.RawCertificateData """ super().__init__(**kwargs) - self.error_code = error_code - self.error_message = error_message - self.provisioning_status = provisioning_status + self.properties = properties + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. -class VirtualNetworkStatusProvisioningStatus(_serialization.Model): - """The provisioning status of the virtual network. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar operation_id: The ID of the operation performed on the virtual network. - :vartype operation_id: str - :ivar status: The status of the operation performed on the virtual network [Succeeded, Failed, - InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :vartype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum + :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 """ + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - *, - operation_id: Optional[str] = None, - status: Optional[Union[str, "_models.ProvisioningStatusEnum"]] = None, - **kwargs - ): - """ - :keyword operation_id: The ID of the operation performed on the virtual network. - :paramtype operation_id: str - :keyword status: The status of the operation performed on the virtual network [Succeeded, - Failed, InProgress]. Known values are: "Succeeded", "Failed", and "InProgress". - :paramtype status: str or ~azure.mgmt.azurestackhci.models.ProvisioningStatusEnum - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.operation_id = operation_id - self.status = status + self.principal_id = None + self.client_id = None diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py index ed88648db311..4f2531a63b22 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py @@ -9,18 +9,13 @@ from ._arc_settings_operations import ArcSettingsOperations from ._clusters_operations import ClustersOperations from ._extensions_operations import ExtensionsOperations -from ._galleryimages_operations import GalleryimagesOperations -from ._marketplacegalleryimages_operations import MarketplacegalleryimagesOperations -from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._offers_operations import OffersOperations from ._operations import Operations -from ._storagecontainers_operations import StoragecontainersOperations -from ._virtualharddisks_operations import VirtualharddisksOperations -from ._virtualmachines_operations import VirtualmachinesOperations -from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._guest_agent_operations import GuestAgentOperations -from ._guest_agents_operations import GuestAgentsOperations -from ._virtualnetworks_operations import VirtualnetworksOperations +from ._publishers_operations import PublishersOperations +from ._skus_operations import SkusOperations +from ._update_runs_operations import UpdateRunsOperations +from ._update_summaries_operations import UpdateSummariesOperations +from ._updates_operations import UpdatesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -30,18 +25,13 @@ "ArcSettingsOperations", "ClustersOperations", "ExtensionsOperations", - "GalleryimagesOperations", - "MarketplacegalleryimagesOperations", - "NetworkinterfacesOperations", + "OffersOperations", "Operations", - "StoragecontainersOperations", - "VirtualharddisksOperations", - "VirtualmachinesOperations", - "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", - "GuestAgentOperations", - "GuestAgentsOperations", - "VirtualnetworksOperations", + "PublishersOperations", + "SkusOperations", + "UpdateRunsOperations", + "UpdateSummariesOperations", + "UpdatesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py index a69d7a3cac84..f4b1fa73bcde 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +44,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,9 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,9 +111,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,15 +142,50 @@ def build_create_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_request( + resource_group_name: str, cluster_name: str, arc_setting_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", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + def build_delete_request( resource_group_name: str, cluster_name: str, arc_setting_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,6 +213,142 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_generate_password_request( + resource_group_name: str, cluster_name: str, arc_setting_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_identity_request( + resource_group_name: str, cluster_name: str, arc_setting_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_consent_and_install_default_extensions_request( + resource_group_name: str, cluster_name: str, arc_setting_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/consentAndInstallDefaultExtensions", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_initialize_disable_process_request( + resource_group_name: str, cluster_name: str, arc_setting_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ArcSettingsOperations: """ .. warning:: @@ -227,9 +387,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ArcSettingList] = kwargs.pop("cls", None) error_map = { @@ -283,8 +441,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,9 +490,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ArcSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -349,8 +506,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,7 +615,7 @@ def create( information. Required. :type arc_setting_name: str :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - Is either a model type or a IO type. Required. + Is either a ArcSetting type or a IO type. Required. :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSetting or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -478,9 +636,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ArcSetting] = kwargs.pop("cls", None) @@ -508,8 +664,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,9 +687,100 @@ def create( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" } - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any - ) -> None: + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: _models.ArcSettingsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Required. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Required. + :type arc_setting: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: Union[_models.ArcSettingsPatch, IO], + **kwargs: Any + ) -> _models.ArcSetting: + """Update ArcSettings for HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param arc_setting: ArcSettings parameters that needs to be updated. Is either a + ArcSettingsPatch type or a IO type. Required. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -541,29 +789,93 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + 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.ArcSetting] = kwargs.pop("cls", None) - request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(arc_setting, (IO, bytes)): + _content = arc_setting + else: + _json = self._serialize.body(arc_setting, "ArcSettingsPatch") + + request = build_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("ArcSetting", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,9 +921,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -653,3 +963,392 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" } + + @distributed_trace + def generate_password( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> _models.PasswordCredential: + """Generate password for arc settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PasswordCredential or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.PasswordCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.PasswordCredential] = kwargs.pop("cls", None) + + request = build_generate_password_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_password.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("PasswordCredential", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_password.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword" + } + + def _create_identity_initial( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> Optional[_models.ArcIdentityResponse]: + error_map = { + 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[Optional[_models.ArcIdentityResponse]] = kwargs.pop("cls", None) + + request = build_create_identity_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._create_identity_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ArcIdentityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" + } + + @distributed_trace + def begin_create_identity( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> LROPoller[_models.ArcIdentityResponse]: + """Create Aad identity for arc settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ArcIdentityResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.ArcIdentityResponse] + :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.ArcIdentityResponse] = 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ArcIdentityResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_identity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" + } + + @distributed_trace + def consent_and_install_default_extensions( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> _models.ArcSetting: + """Add consent time for default extensions and initiate extensions installation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArcSetting or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.ArcSetting] = kwargs.pop("cls", None) + + request = build_consent_and_install_default_extensions_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.consent_and_install_default_extensions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("ArcSetting", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + consent_and_install_default_extensions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/consentAndInstallDefaultExtensions" + } + + def _initialize_disable_process_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_initialize_disable_process_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._initialize_disable_process_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + 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, None, {}) + + _initialize_disable_process_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + } + + @distributed_trace + def begin_initialize_disable_process( + self, resource_group_name: str, cluster_name: str, arc_setting_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Initializes ARC Disable process on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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._initialize_disable_process_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_initialize_disable_process.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py index d77bb0ad16df..3cc4084d18a2 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,19 +20,17 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +42,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,9 +66,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,9 +96,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,9 +129,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,9 +165,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -214,9 +201,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,6 +228,111 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_upload_certificate_request( + resource_group_name: str, cluster_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", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_identity_request( + resource_group_name: str, cluster_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_extend_software_assurance_benefit_request( + resource_group_name: str, cluster_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", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ClustersOperations: """ .. warning:: @@ -274,9 +364,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -328,8 +416,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,9 +450,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) error_map = { @@ -416,8 +503,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,9 +547,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -476,8 +562,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,7 +652,7 @@ def create( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. + :param cluster: Details of the HCI cluster. Is either a Cluster type or a IO type. Required. :type cluster: ~azure.mgmt.azurestackhci.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -586,9 +673,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) @@ -615,8 +700,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -704,7 +790,8 @@ def update( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param cluster: Details of the HCI cluster. Is either a model type or a IO type. Required. + :param cluster: Details of the HCI cluster. Is either a ClusterPatch type or a IO type. + Required. :type cluster: ~azure.mgmt.azurestackhci.models.ClusterPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -725,9 +812,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) @@ -754,8 +839,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -776,10 +862,56 @@ def update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202, 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: """Delete an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -788,10 +920,67 @@ def delete( # pylint: disable=inconsistent-return-statements :param cluster_name: The name of the cluster. Required. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + } + + def _upload_certificate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: Union[_models.UploadCertificateRequest, IO], + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -800,33 +989,44 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) - request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(upload_certificate_request, (IO, bytes)): + _content = upload_certificate_request + else: + _json = self._serialize.body(upload_certificate_request, "UploadCertificateRequest") + + request = build_upload_certificate_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self._upload_certificate_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: 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) @@ -834,6 +1034,508 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + _upload_certificate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" + } + + @overload + def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: _models.UploadCertificateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Required. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @overload + def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Required. + :type upload_certificate_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @distributed_trace + def begin_upload_certificate( + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: Union[_models.UploadCertificateRequest, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Upload certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param upload_certificate_request: Upload certificate request. Is either a + UploadCertificateRequest type or a IO type. Required. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 {}) + + 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._upload_certificate_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + upload_certificate_request=upload_certificate_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upload_certificate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" + } + + def _create_identity_initial( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Optional[_models.ClusterIdentityResponse]: + error_map = { + 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[Optional[_models.ClusterIdentityResponse]] = kwargs.pop("cls", None) + + request = build_create_identity_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._create_identity_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("ClusterIdentityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" + } + + @distributed_trace + def begin_create_identity( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> LROPoller[_models.ClusterIdentityResponse]: + """Create cluster identity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ClusterIdentityResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.ClusterIdentityResponse] + :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.ClusterIdentityResponse] = 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ClusterIdentityResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_identity.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" + } + + def _extend_software_assurance_benefit_initial( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: Union[_models.SoftwareAssuranceChangeRequest, IO], + **kwargs: Any + ) -> Optional[_models.Cluster]: + error_map = { + 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[Optional[_models.Cluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(software_assurance_change_request, (IO, bytes)): + _content = software_assurance_change_request + else: + _json = self._serialize.body(software_assurance_change_request, "SoftwareAssuranceChangeRequest") + + request = build_extend_software_assurance_benefit_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._extend_software_assurance_benefit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize("Cluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _extend_software_assurance_benefit_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" + } + + @overload + def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: _models.SoftwareAssuranceChangeRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Required. + :type software_assurance_change_request: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Required. + :type software_assurance_change_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_extend_software_assurance_benefit( + self, + resource_group_name: str, + cluster_name: str, + software_assurance_change_request: Union[_models.SoftwareAssuranceChangeRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.Cluster]: + """Extends Software Assurance Benefit to a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param software_assurance_change_request: Software Assurance Change Request Payload. Is either + a SoftwareAssuranceChangeRequest type or a IO type. Required. + :type software_assurance_change_request: + ~azure.mgmt.azurestackhci.models.SoftwareAssuranceChangeRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Cluster] + :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.Cluster] = 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._extend_software_assurance_benefit_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + software_assurance_change_request=software_assurance_change_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Cluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_extend_software_assurance_benefit.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py index 63667a6e745e..e4c61e6e41a6 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +44,7 @@ def build_list_by_arc_setting_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,9 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,9 +123,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -177,9 +166,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -222,9 +209,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,6 +238,49 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_upgrade_request( + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_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", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ExtensionsOperations: """ .. warning:: @@ -294,9 +322,7 @@ def list_by_arc_setting( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExtensionList] = kwargs.pop("cls", None) error_map = { @@ -351,8 +377,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,9 +428,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) request = build_get_request( @@ -420,8 +445,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,9 +488,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) @@ -493,8 +517,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,8 +650,8 @@ def begin_create( :type arc_setting_name: str :param extension_name: The name of the machine extension. Required. :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. + :param extension: Details of the Machine Extension to be created. Is either a Extension type or + a IO type. Required. :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -646,9 +671,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -705,7 +728,7 @@ def _update_initial( extension_name: str, extension: Union[_models.Extension, IO], **kwargs: Any - ) -> _models.Extension: + ) -> Optional[_models.Extension]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -717,11 +740,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.Extension]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -748,18 +769,21 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: 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("Extension", pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -876,8 +900,8 @@ def begin_update( :type arc_setting_name: str :param extension_name: The name of the machine extension. Required. :type extension_name: str - :param extension: Details of the Machine Extension to be created. Is either a model type or a - IO type. Required. + :param extension: Details of the Machine Extension to be created. Is either a Extension type or + a IO type. Required. :type extension: ~azure.mgmt.azurestackhci.models.Extension or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -897,9 +921,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Extension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -962,9 +984,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -981,8 +1001,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1030,9 +1051,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1075,3 +1094,248 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" } + + def _upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: Union[_models.ExtensionUpgradeParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_upgrade_parameters, (IO, bytes)): + _content = extension_upgrade_parameters + else: + _json = self._serialize.body(extension_upgrade_parameters, "ExtensionUpgradeParameters") + + request = build_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 [202]: + 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, None, {}) + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + } + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: _models.ExtensionUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: ~azure.mgmt.azurestackhci.models.ExtensionUpgradeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: + """ + + @distributed_trace + def begin_upgrade( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension_upgrade_parameters: Union[_models.ExtensionUpgradeParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade a particular Arc Extension of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting + information. Required. + :type arc_setting_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Is either a ExtensionUpgradeParameters type or a IO type. Required. + :type extension_upgrade_parameters: ~azure.mgmt.azurestackhci.models.ExtensionUpgradeParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 {}) + + 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._upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + extension_upgrade_parameters=extension_upgrade_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py deleted file mode 100644 index 1f9810b41de5..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py +++ /dev/null @@ -1,950 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, galleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "galleryimagesName": _SERIALIZER.url( - "galleryimages_name", galleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class GalleryimagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`galleryimages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, galleryimages_name: str, **kwargs: Any) -> _models.Galleryimages: - """Gets galleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Galleryimages] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> _models.Galleryimages: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "Galleryimages") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.Galleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.Galleryimages, IO], - **kwargs: Any - ) -> LROPoller[_models.Galleryimages]: - """Create or update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Galleryimages or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Galleryimages] = 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_or_update_initial( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - galleryimages=galleryimages, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Galleryimages", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, galleryimages_name: str, **kwargs: Any - ) -> None: - """Delete a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @overload - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: _models.GalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Required. - :type galleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - galleryimages_name: str, - galleryimages: Union[_models.GalleryimagesPatch, IO], - **kwargs: Any - ) -> _models.Galleryimages: - """Update a gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param galleryimages_name: Name of the gallery image. Required. - :type galleryimages_name: str - :param galleryimages: Is either a model type or a IO type. Required. - :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Galleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Galleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(galleryimages, (IO, bytes)): - _content = galleryimages - else: - _json = self._serialize.body(galleryimages, "GalleryimagesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - galleryimages_name=galleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Galleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Galleryimages"]: - """Lists all galleryimages under the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryimagesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Galleryimages"]: - """List all galleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Galleryimages or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Galleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GalleryimagesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py deleted file mode 100644 index 4e40c4283904..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,1026 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, name: str, extension_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - 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 - ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, name: str, extension_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - 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 - ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, name: str, extension_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - 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 - ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, name: str, extension_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - 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 - ), - "name": _SERIALIZER.url("name", name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_virtual_machines_request( - resource_group_name: str, 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions", - ) # pylint: disable=line-too-long - 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 - ), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _format_url_section(_url, **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") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_or_update_initial( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.MachineExtension] = 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_or_update_initial( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - def _update_initial( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be created or updated. - Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.azurestackhci.models.MachineExtensionUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.MachineExtension] = 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, - name=name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 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) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine where the extension should be deleted. Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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_initial( # type: ignore - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace - def get(self, resource_group_name: str, name: str, extension_name: str, **kwargs: Any) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - name=name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}" - } - - @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the machine containing the extension. Required. - :type name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_virtual_machines_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py deleted file mode 100644 index a22271bd4028..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_marketplacegalleryimages_operations.py +++ /dev/null @@ -1,962 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, marketplacegalleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, marketplacegalleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, marketplacegalleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, marketplacegalleryimages_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}", - ) # pylint: disable=line-too-long - 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 - ), - "marketplacegalleryimagesName": _SERIALIZER.url( - "marketplacegalleryimages_name", marketplacegalleryimages_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MarketplacegalleryimagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`marketplacegalleryimages` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Gets marketplacegalleryimages by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Marketplacegalleryimages] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages - else: - _json = self._serialize.body(marketplacegalleryimages, "Marketplacegalleryimages") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.Marketplacegalleryimages, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Marketplacegalleryimages or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Marketplacegalleryimages or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.Marketplacegalleryimages, IO], - **kwargs: Any - ) -> LROPoller[_models.Marketplacegalleryimages]: - """Creates or updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Marketplacegalleryimages or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = 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_or_update_initial( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - marketplacegalleryimages=marketplacegalleryimages, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, marketplacegalleryimages_name: str, **kwargs: Any - ) -> None: - """Deletes a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @overload - def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: _models.MarketplacegalleryimagesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Required. - :type marketplacegalleryimages: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - marketplacegalleryimages_name: str, - marketplacegalleryimages: Union[_models.MarketplacegalleryimagesPatch, IO], - **kwargs: Any - ) -> _models.Marketplacegalleryimages: - """Updates a marketplace gallery image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param marketplacegalleryimages_name: Name of the marketplace gallery image. Required. - :type marketplacegalleryimages_name: str - :param marketplacegalleryimages: Is either a model type or a IO type. Required. - :type marketplacegalleryimages: ~azure.mgmt.azurestackhci.models.MarketplacegalleryimagesPatch - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Marketplacegalleryimages or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Marketplacegalleryimages - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Marketplacegalleryimages] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(marketplacegalleryimages, (IO, bytes)): - _content = marketplacegalleryimages - else: - _json = self._serialize.body(marketplacegalleryimages, "MarketplacegalleryimagesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - marketplacegalleryimages_name=marketplacegalleryimages_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Marketplacegalleryimages", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/{marketplacegalleryimagesName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Marketplacegalleryimages"]: - """Lists all marketplacegalleryimages under the subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Marketplacegalleryimages or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Marketplacegalleryimages] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MarketplacegalleryimagesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MarketplacegalleryimagesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplacegalleryimages" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py deleted file mode 100644 index 4088a6160371..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py +++ /dev/null @@ -1,954 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, networkinterfaces_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", - ) # pylint: disable=line-too-long - 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 - ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, networkinterfaces_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", - ) # pylint: disable=line-too-long - 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 - ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, networkinterfaces_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", - ) # pylint: disable=line-too-long - 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 - ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, networkinterfaces_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}", - ) # pylint: disable=line-too-long - 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 - ), - "networkinterfacesName": _SERIALIZER.url( - "networkinterfaces_name", networkinterfaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class NetworkinterfacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`networkinterfaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve( - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> _models.Networkinterfaces: - """Gets network interfaces by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Networkinterfaces] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "Networkinterfaces") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.Networkinterfaces, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.Networkinterfaces, IO], - **kwargs: Any - ) -> LROPoller[_models.Networkinterfaces]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Networkinterfaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = 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_or_update_initial( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - networkinterfaces=networkinterfaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, networkinterfaces_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @overload - def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: _models.NetworkinterfacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Required. - :type networkinterfaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - networkinterfaces_name: str, - networkinterfaces: Union[_models.NetworkinterfacesPatch, IO], - **kwargs: Any - ) -> _models.Networkinterfaces: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param networkinterfaces_name: Required. - :type networkinterfaces_name: str - :param networkinterfaces: Is either a model type or a IO type. Required. - :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Networkinterfaces or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Networkinterfaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(networkinterfaces, (IO, bytes)): - _content = networkinterfaces - else: - _json = self._serialize.body(networkinterfaces, "NetworkinterfacesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - networkinterfaces_name=networkinterfaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Networkinterfaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Networkinterfaces"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Networkinterfaces"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Networkinterfaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Networkinterfaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.NetworkinterfacesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkinterfacesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_offers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_offers_operations.py new file mode 100644 index 000000000000..b57aa4feffc1 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_offers_operations.py @@ -0,0 +1,458 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_publisher_request( + resource_group_name: str, + cluster_name: str, + publisher_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + } + + _url: str = _format_url_section(_url, **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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_cluster_request( + resource_group_name: str, cluster_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offerName": _SERIALIZER.url("offer_name", offer_name, "str"), + } + + _url: str = _format_url_section(_url, **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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class OffersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s + :attr:`offers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_publisher( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Offer"]: + """List Offers available for a publisher within the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Offer] + :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.OfferList] = kwargs.pop("cls", None) + + error_map = { + 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_by_publisher_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_publisher.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OfferList", 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) + + 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 = 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) + + list_by_publisher.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers" + } + + @distributed_trace + def list_by_cluster( + self, resource_group_name: str, cluster_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.Offer"]: + """List Offers available across publishers for the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Offer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Offer] + :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.OfferList] = kwargs.pop("cls", None) + + error_map = { + 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_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OfferList", 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) + + 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 = 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) + + list_by_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Offer: + """Get Offer resource details within a publisher of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Offer or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Offer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Offer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("Offer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py index 2eca031ce230..a0ec7b81fbec 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,9 +38,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,9 +92,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( @@ -113,8 +104,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_publishers_operations.py similarity index 51% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_publishers_operations.py index b8196463b9dc..2ab87439fcf4 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agents_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_publishers_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,28 +36,26 @@ _SERIALIZER.client_side_validation = False -def build_list_by_virtual_machines_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any +def build_list_by_cluster_request( + resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -76,14 +69,48 @@ def build_list_by_virtual_machines_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class GuestAgentsOperations: +def build_get_request( + resource_group_name: str, cluster_name: str, publisher_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PublishersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`guest_agents` attribute. + :attr:`publishers` attribute. """ models = _models @@ -96,30 +123,26 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.GuestAgent"]: - """Implements GET GuestAgent in a vm. - - Returns the list of GuestAgent of the given vm. + def list_by_cluster( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.Publisher"]: + """List Publishers available for the HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GuestAgent or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GuestAgent] + :return: An iterator like instance of either Publisher or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Publisher] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublisherList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -132,12 +155,12 @@ def list_by_virtual_machines( def prepare_request(next_link=None): if not next_link: - request = build_list_by_virtual_machines_request( + request = build_list_by_cluster_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], + template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -163,7 +186,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("GuestAgentList", pipeline_response) + deserialized = self._deserialize("PublisherList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -172,8 +195,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,6 +210,72 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents" + list_by_cluster.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers" + } + + @distributed_trace + def get(self, resource_group_name: str, cluster_name: str, publisher_name: str, **kwargs: Any) -> _models.Publisher: + """Get Publisher resource details of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Publisher or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Publisher + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Publisher] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("Publisher", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_skus_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_skus_operations.py new file mode 100644 index 000000000000..bb545b8d4f5b --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_skus_operations.py @@ -0,0 +1,339 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_offer_request( + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offerName": _SERIALIZER.url("offer_name", offer_name, "str"), + } + + _url: str = _format_url_section(_url, **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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + sku_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offerName": _SERIALIZER.url("offer_name", offer_name, "str"), + "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + } + + _url: str = _format_url_section(_url, **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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s + :attr:`skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_offer( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Sku"]: + """List Skus available for a offer within the HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Sku or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Sku] + :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.SkuList] = kwargs.pop("cls", None) + + error_map = { + 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_by_offer_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list_by_offer.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SkuList", 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) + + 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 = 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) + + list_by_offer.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_name: str, + publisher_name: str, + offer_name: str, + sku_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Sku: + """Get SKU resource details within a offer of HCI Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param publisher_name: The name of the publisher available within HCI cluster. Required. + :type publisher_name: str + :param offer_name: The name of the offer available within HCI cluster. Required. + :type offer_name: str + :param sku_name: The name of the SKU available within HCI cluster. Required. + :type sku_name: str + :param expand: Specify $expand=content,contentVersion to populate additional fields related to + the marketplace offer. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Sku or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Sku + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Sku] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + publisher_name=publisher_name, + offer_name=offer_name, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("Sku", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}" + } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py deleted file mode 100644 index 6aa97b6b4cbf..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_storagecontainers_operations.py +++ /dev/null @@ -1,954 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, storagecontainers_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", - ) # pylint: disable=line-too-long - 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 - ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, storagecontainers_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", - ) # pylint: disable=line-too-long - 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 - ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, storagecontainers_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", - ) # pylint: disable=line-too-long - 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 - ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, storagecontainers_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}", - ) # pylint: disable=line-too-long - 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 - ), - "storagecontainersName": _SERIALIZER.url( - "storagecontainers_name", storagecontainers_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StoragecontainersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`storagecontainers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve( - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> _models.Storagecontainers: - """Gets storagecontainers by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Storagecontainers] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], - **kwargs: Any - ) -> _models.Storagecontainers: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Storagecontainers] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers - else: - _json = self._serialize.body(storagecontainers, "Storagecontainers") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.Storagecontainers, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.Storagecontainers, IO], - **kwargs: Any - ) -> LROPoller[_models.Storagecontainers]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.Storagecontainers or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Storagecontainers or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Storagecontainers] = 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_or_update_initial( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - storagecontainers=storagecontainers, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Storagecontainers", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storagecontainers_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @overload - def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: _models.StoragecontainersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Required. - :type storagecontainers: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - storagecontainers_name: str, - storagecontainers: Union[_models.StoragecontainersPatch, IO], - **kwargs: Any - ) -> _models.Storagecontainers: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storagecontainers_name: Required. - :type storagecontainers_name: str - :param storagecontainers: Is either a model type or a IO type. Required. - :type storagecontainers: ~azure.mgmt.azurestackhci.models.StoragecontainersPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Storagecontainers or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Storagecontainers - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Storagecontainers] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storagecontainers, (IO, bytes)): - _content = storagecontainers - else: - _json = self._serialize.body(storagecontainers, "StoragecontainersPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - storagecontainers_name=storagecontainers_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Storagecontainers", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers/{storagecontainersName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Storagecontainers"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storagecontainers" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Storagecontainers"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Storagecontainers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Storagecontainers] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StoragecontainersListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StoragecontainersListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storagecontainers" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_runs_operations.py similarity index 52% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_runs_operations.py index 65084cf3d77d..e3b4c0c288a8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_guest_agent_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_runs_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +17,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -30,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,30 +38,27 @@ _SERIALIZER.client_side_validation = False -def build_create_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any +def build_list_request( + resource_group_name: str, cluster_name: str, update_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -73,36 +67,38 @@ def build_create_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), + "updateRunName": _SERIALIZER.url("update_run_name", update_run_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -113,32 +109,37 @@ def build_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any +def build_put_request( + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), + "updateRunName": _SERIALIZER.url("update_run_name", update_run_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -147,19 +148,61 @@ def build_delete_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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_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", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}", + ) # pylint: disable=line-too-long + 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 + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), + "updateRunName": _SERIALIZER.url("update_run_name", update_run_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class GuestAgentOperations: +class UpdateRunsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`guest_agent` attribute. + :attr:`update_runs` attribute. """ models = _models @@ -171,14 +214,30 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _create_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any - ) -> _models.GuestAgent: + @distributed_trace + def list( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> Iterable["_models.UpdateRun"]: + """List all Update runs for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateRun or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.UpdateRun] + :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.UpdateRunList] = kwargs.pop("cls", None) + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -187,173 +246,140 @@ def _create_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 {}) - - api_version: Literal["2021-09-01-preview"] = 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.GuestAgent] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "GuestAgent") else: - _json = None + # 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateRunList", 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) - request = build_create_request( + 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 = 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202, 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) - if response.status_code == 200: - deserialized = self._deserialize("GuestAgent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GuestAgent", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - @overload - def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[_models.GuestAgent] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.GuestAgent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.GuestAgent]: - """Implements GuestAgent PUT method. - - Create Or Update GuestAgent. + def begin_delete( + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specified Update Run. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.GuestAgent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -362,29 +388,25 @@ def begin_create( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GuestAgent or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.GuestAgent] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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.GuestAgent] = kwargs.pop("cls", None) + 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._create_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - body=body, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -392,11 +414,9 @@ def begin_create( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GuestAgent", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: PollingMethod = cast( @@ -415,26 +435,108 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - @distributed_trace - def get(self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any) -> _models.GuestAgent: - """Gets GuestAgent. + @overload + def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: _models.UpdateRun, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Required. + :type update_runs_properties: ~azure.mgmt.azurestackhci.models.UpdateRun + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Required. + :type update_runs_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ - Implements GuestAgent GET method. + @distributed_trace + def put( + self, + resource_group_name: str, + cluster_name: str, + update_name: str, + update_run_name: str, + update_runs_properties: Union[_models.UpdateRun, IO], + **kwargs: Any + ) -> _models.UpdateRun: + """Put Update runs for a specified update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :param update_runs_properties: Properties of the updateRuns object. Is either a UpdateRun type + or a IO type. Required. + :type update_runs_properties: ~azure.mgmt.azurestackhci.models.UpdateRun or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: GuestAgent or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.GuestAgent + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -445,29 +547,41 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) + 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.UpdateRun] = kwargs.pop("cls", None) - request = build_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_runs_properties, (IO, bytes)): + _content = update_runs_properties + else: + _json = self._serialize.body(update_runs_properties, "UpdateRun") + + request = build_put_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,20 +591,37 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = self._deserialize("UpdateRun", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> None: + @distributed_trace + def get( + self, resource_group_name: str, cluster_name: str, update_name: str, update_run_name: str, **kwargs: Any + ) -> _models.UpdateRun: + """Get the Update run for a specified update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_run_name: The name of the Update Run. Required. + :type update_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateRun or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateRun + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -502,111 +633,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - request = build_delete_request( + request = build_get_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + cluster_name=cluster_name, + update_name=update_name, + update_run_name=update_run_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + 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]: 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, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" - } + deserialized = self._deserialize("UpdateRun", pipeline_response) - @distributed_trace - def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an GuestAgent. - - Implements GuestAgent DELETE method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + if cls: + return cls(pipeline_response, deserialized, {}) - 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.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return deserialized - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/guestAgents/{name}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_summaries_operations.py similarity index 62% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_summaries_operations.py index 641299c17dba..22ec75daa569 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_update_summaries_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,19 +20,17 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,30 +38,24 @@ _SERIALIZER.client_side_validation = False -def build_create_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -73,36 +64,31 @@ def build_create_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -113,32 +99,28 @@ def build_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_put_request(resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -147,33 +129,31 @@ def build_delete_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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_virtual_machines_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_get_request(resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default", ) # pylint: disable=line-too-long 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 ), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -187,14 +167,14 @@ def build_list_by_virtual_machines_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class HybridIdentityMetadataOperations: +class UpdateSummariesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`hybrid_identity_metadata` attribute. + :attr:`update_summaries` attribute. """ models = _models @@ -206,100 +186,296 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterable["_models.UpdateSummaries"]: + """List all Update summaries under the HCI cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateSummaries or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.UpdateSummaries] + :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.UpdateSummariesList] = kwargs.pop("cls", None) + + error_map = { + 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_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateSummariesList", 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) + + 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 = 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> None: + error_map = { + 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[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete Update Summaries. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + } + @overload - def create( + def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[_models.HybridIdentityMetadata] = None, + cluster_name: str, + update_location_properties: _models.UpdateSummaries, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Required. + :type update_location_properties: ~azure.mgmt.azurestackhci.models.UpdateSummaries :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create( + def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[IO] = None, + cluster_name: str, + update_location_properties: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Required. + :type update_location_properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create( + def put( self, resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, + cluster_name: str, + update_location_properties: Union[_models.UpdateSummaries, IO], **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. + ) -> _models.UpdateSummaries: + """Put Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata or IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_location_properties: Properties of the UpdateSummaries resource. Is either a + UpdateSummaries type or a IO type. Required. + :type update_location_properties: ~azure.mgmt.azurestackhci.models.UpdateSummaries or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -313,41 +489,36 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.HybridIdentityMetadata] = kwargs.pop("cls", None) + cls: ClsType[_models.UpdateSummaries] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): - _content = body + if isinstance(update_location_properties, (IO, bytes)): + _content = update_location_properties else: - if body is not None: - _json = self._serialize.body(body, "HybridIdentityMetadata") - else: - _json = None + _json = self._serialize.body(update_location_properties, "UpdateSummaries") - request = build_create_request( + request = build_put_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,35 +528,29 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("UpdateSummaries", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" } @distributed_trace - def get( - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Gets HybridIdentityMetadata. - - Implements HybridIdentityMetadata GET method. + def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.UpdateSummaries: + """Get all Update summaries under the HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.HybridIdentityMetadata + :return: UpdateSummaries or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.UpdateSummaries :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -399,15 +564,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UpdateSummaries] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], @@ -417,8 +579,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,7 +591,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("UpdateSummaries", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -436,168 +599,5 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> None: - """Deletes an HybridIdentityMetadata. - - Implements HybridIdentityMetadata DELETE method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def list_by_virtual_machines( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.HybridIdentityMetadata"]: - """Implements GET HybridIdentityMetadata in a vm. - - Returns the list of HybridIdentityMetadata of the given vm. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridIdentityMetadata or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.HybridIdentityMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) - - error_map = { - 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_by_virtual_machines_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_virtual_machines.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("HybridIdentityMetadataList", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_virtual_machines.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_updates_operations.py similarity index 52% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_updates_operations.py index 24905b034e7e..d3d6e8d0350c 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_updates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,30 +38,27 @@ _SERIALIZER.client_side_validation = False -def build_retrieve_request( - resource_group_name: str, virtualnetworks_name: str, subscription_id: str, **kwargs: Any +def build_post_request( + resource_group_name: str, cluster_name: str, update_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply", ) # pylint: disable=line-too-long 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 ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -77,34 +69,27 @@ def build_retrieve_request( # Construct headers _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_create_or_update_request( - resource_group_name: str, virtualnetworks_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_group_name: str, cluster_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates", ) # pylint: disable=line-too-long 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 ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -113,37 +98,32 @@ def build_create_or_update_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, virtualnetworks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, cluster_name: str, update_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}", ) # pylint: disable=line-too-long 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 ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -157,31 +137,28 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - resource_group_name: str, virtualnetworks_name: str, subscription_id: str, **kwargs: Any +def build_put_request( + resource_group_name: str, cluster_name: str, update_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}", ) # pylint: disable=line-too-long 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 ), - "virtualnetworksName": _SERIALIZER.url( - "virtualnetworks_name", virtualnetworks_name, "str", max_length=64, min_length=3 - ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -194,28 +171,30 @@ def build_update_request( _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request( + resource_group_name: str, cluster_name: str, update_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}", ) # pylint: disable=line-too-long 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 ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "updateName": _SERIALIZER.url("update_name", update_name, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -229,42 +208,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualnetworksOperations: +class UpdatesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualnetworks` attribute. + :attr:`updates` attribute. """ models = _models @@ -276,20 +227,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def retrieve(self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any) -> _models.Virtualnetworks: - """retrieve. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _post_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -301,210 +241,60 @@ def retrieve(self, resource_group_name: str, virtualnetworks_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualnetworks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualnetworks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> _models.Virtualnetworks: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks - else: - _json = self._serialize.body(virtualnetworks, "Virtualnetworks") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_create_or_update_request( + request = build_post_request( resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], + template_url=self._post_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: 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 response.status_code == 200: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, response_headers) - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" + _post_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" } - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.Virtualnetworks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.Virtualnetworks, IO], - **kwargs: Any - ) -> LROPoller[_models.Virtualnetworks]: - """create_or_update. + def begin_post( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Apply Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -513,29 +303,24 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualnetworks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = 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.Virtualnetworks] = kwargs.pop("cls", None) + 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._create_or_update_initial( + raw_result = self._post_initial( # type: ignore resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, - virtualnetworks=virtualnetworks, + cluster_name=cluster_name, + update_name=update_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -543,11 +328,9 @@ def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualnetworks", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: PollingMethod = cast( @@ -566,26 +349,103 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" + begin_post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" } @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualnetworks_name: str, **kwargs: Any - ) -> None: - """delete. + def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterable["_models.Update"]: + """List all Updates. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: An iterator like instance of either Update or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Update] :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.UpdateList] = kwargs.pop("cls", None) + + error_map = { + 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_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateList", 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) + + 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 = 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -597,120 +457,207 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 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) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specified Update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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 = 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_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } @overload - def update( + def put( self, resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: _models.VirtualnetworksPatch, + cluster_name: str, + update_name: str, + update_properties: _models.Update, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Virtualnetworks: - """update. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Required. + :type update_properties: ~azure.mgmt.azurestackhci.models.Update :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def put( self, resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: IO, + cluster_name: str, + update_name: str, + update_properties: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Virtualnetworks: - """update. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Required. - :type virtualnetworks: IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Required. + :type update_properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def put( self, resource_group_name: str, - virtualnetworks_name: str, - virtualnetworks: Union[_models.VirtualnetworksPatch, IO], + cluster_name: str, + update_name: str, + update_properties: Union[_models.Update, IO], **kwargs: Any - ) -> _models.Virtualnetworks: - """update. + ) -> _models.Update: + """Put specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtualnetworks_name: Required. - :type virtualnetworks_name: str - :param virtualnetworks: Is either a model type or a IO type. Required. - :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch or IO + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str + :param update_properties: Properties of the Updates object. Is either a Update type or a IO + type. Required. + :type update_properties: ~azure.mgmt.azurestackhci.models.Update or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualnetworks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -724,81 +671,73 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Virtualnetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.Update] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtualnetworks, (IO, bytes)): - _content = virtualnetworks + if isinstance(update_properties, (IO, bytes)): + _content = update_properties else: - _json = self._serialize.body(virtualnetworks, "VirtualnetworksPatch") + _json = self._serialize.body(update_properties, "Update") - request = build_update_request( + request = build_put_request( resource_group_name=resource_group_name, - virtualnetworks_name=virtualnetworks_name, + cluster_name=cluster_name, + update_name=update_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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 response.status_code == 200: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualnetworks", pipeline_response) + deserialized = self._deserialize("Update", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}" + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualnetworks"]: - """list_by_resource_group. + def get(self, resource_group_name: str, cluster_name: str, update_name: str, **kwargs: Any) -> _models.Update: + """Get specified Update. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param update_name: The name of the Update. Required. + :type update_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :return: Update or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Update :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -807,146 +746,44 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualnetworksListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualnetworks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualnetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualnetworks] - :raises ~azure.core.exceptions.HttpResponseError: - """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualnetworksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Update] = 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + update_name=update_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualnetworksListResult", 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 = 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 - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - 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("Update", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return ItemPaged(get_next, extract_data) + return deserialized - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py deleted file mode 100644 index a4edb39c3050..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py +++ /dev/null @@ -1,952 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, virtualharddisks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, virtualharddisks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, virtualharddisks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, virtualharddisks_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualharddisksName": _SERIALIZER.url( - "virtualharddisks_name", virtualharddisks_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualharddisksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualharddisks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any) -> _models.Virtualharddisks: - """Gets virtualharddisks by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualharddisks] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], - **kwargs: Any - ) -> _models.Virtualharddisks: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks - else: - _json = self._serialize.body(virtualharddisks, "Virtualharddisks") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.Virtualharddisks, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.Virtualharddisks, IO], - **kwargs: Any - ) -> LROPoller[_models.Virtualharddisks]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualharddisks or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = 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_or_update_initial( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - virtualharddisks=virtualharddisks, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualharddisks_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @overload - def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: _models.VirtualharddisksPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Required. - :type virtualharddisks: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - virtualharddisks_name: str, - virtualharddisks: Union[_models.VirtualharddisksPatch, IO], - **kwargs: Any - ) -> _models.Virtualharddisks: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualharddisks_name: Required. - :type virtualharddisks_name: str - :param virtualharddisks: Is either a model type or a IO type. Required. - :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualharddisks or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualharddisks] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualharddisks, (IO, bytes)): - _content = virtualharddisks - else: - _json = self._serialize.body(virtualharddisks, "VirtualharddisksPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualharddisks_name=virtualharddisks_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualharddisks", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualharddisks"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualharddisks"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualharddisks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualharddisks] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualharddisksListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualharddisksListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py deleted file mode 100644 index b975d12e7ffc..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py +++ /dev/null @@ -1,1414 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, virtualmachines_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart", - ) # pylint: disable=line-too-long - 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 - ), - "virtualmachinesName": _SERIALIZER.url( - "virtualmachines_name", virtualmachines_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines", - ) # pylint: disable=line-too-long - 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 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualmachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.azurestackhci.AzureStackHCIClient`'s - :attr:`virtualmachines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> _models.Virtualmachines: - """Gets virtual machines by resource name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Virtualmachines] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> _models.Virtualmachines: - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualmachines] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines - else: - _json = self._serialize.body(virtualmachines, "Virtualmachines") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.Virtualmachines, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.Virtualmachines, IO], - **kwargs: Any - ) -> LROPoller[_models.Virtualmachines]: - """create_or_update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either Virtualmachines or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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.Virtualmachines] = 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_or_update_initial( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - virtualmachines=virtualmachines, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Virtualmachines", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - 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) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - @overload - def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: _models.VirtualmachinesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Required. - :type virtualmachines: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - virtualmachines_name: str, - virtualmachines: Union[_models.VirtualmachinesPatch, IO], - **kwargs: Any - ) -> _models.Virtualmachines: - """update. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :param virtualmachines: Is either a model type or a IO type. Required. - :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Virtualmachines or the result of cls(response) - :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2021-09-01-preview"] = 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.Virtualmachines] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(virtualmachines, (IO, bytes)): - _content = virtualmachines - else: - _json = self._serialize.body(virtualmachines, "VirtualmachinesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - 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 response.status_code == 200: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Virtualmachines", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}" - } - - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" - } - - @distributed_trace - def begin_start(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """start. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start" - } - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_stop_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" - } - - @distributed_trace - def begin_stop(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """stop. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop" - } - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any - ) -> None: - error_map = { - 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: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, None, {}) - - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" - } - - @distributed_trace - def begin_restart(self, resource_group_name: str, virtualmachines_name: str, **kwargs: Any) -> LROPoller[None]: - """restart. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtualmachines_name: Required. - :type virtualmachines_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = 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._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtualmachines_name=virtualmachines_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Virtualmachines"]: - """list_by_resource_group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Virtualmachines"]: - """list_by_subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Virtualmachines or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.Virtualmachines] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualmachinesListResult] = kwargs.pop("cls", None) - - error_map = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualmachinesListResult", 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) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines" - } diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/consent_and_install_default_extensions.py similarity index 82% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/consent_and_install_default_extensions.py index 76e9b4ab7b84..6d6041f403f1 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_storage_container.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/consent_and_install_default_extensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_storage_container.py + python consent_and_install_default_extensions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.delete( + response = client.arc_settings.consent_and_install_default_extensions( resource_group_name="test-rg", - storagecontainers_name="Default_Container", + cluster_name="myCluster", + arc_setting_name="default", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteStorageContainer.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ConsentAndInstallDefaultExtensions.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_arc_identity.py similarity index 85% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_arc_identity.py index 8c9cd5f4543e..6c1cc2fa735b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/restart_virtual_machine.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_arc_identity.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python restart_virtual_machine.py + python create_arc_identity.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualmachines.begin_restart( + response = client.arc_settings.begin_create_identity( resource_group_name="test-rg", - virtualmachines_name="test-vm", + cluster_name="myCluster", + arc_setting_name="default", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/RestartVirtualMachine.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/CreateArcIdentity.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py index 516731fc9eae..3f9255b3dbe7 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster.py @@ -33,6 +33,7 @@ def main(): resource_group_name="test-rg", cluster_name="myCluster", cluster={ + "identity": {"type": "SystemAssigned"}, "location": "East US", "properties": { "aadClientId": "24a6e53d-04e5-44d2-b7cc-1b732a847dfc", @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/CreateCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster_identity.py similarity index 86% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster_identity.py index 5bb132fe0df3..828a71494d10 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/stop_virtual_machine.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_cluster_identity.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python stop_virtual_machine.py + python create_cluster_identity.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualmachines.begin_stop( + response = client.clusters.begin_create_identity( resource_group_name="test-rg", - virtualmachines_name="test-vm", + cluster_name="myCluster", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/StopVirtualMachine.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/CreateClusterIdentity.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py index 05c12b00a815..c46a09b4fc2f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_arc_setting.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteArcSetting.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteArcSetting.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py index 633ef85f66e1..0a16fe0d36fc 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_cluster.py @@ -29,13 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.delete( + response = client.clusters.begin_delete( resource_group_name="test-rg", cluster_name="myCluster", - ) + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py index beda1e1f1caa..7d38ba60ac28 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_extension.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteExtension.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py deleted file mode 100644 index 8fad23cac42d..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_machine_extension.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python delete_machine_extension.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_delete( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="MMA", - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_runs.py similarity index 77% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_runs.py index c07955652258..cc522def9413 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_hybrid_identity_metadata.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_runs.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_hybrid_identity_metadata.py + python delete_update_runs.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,18 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.hybrid_identity_metadata.delete( + response = client.update_runs.begin_delete( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", - ) + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + update_run_name="23b779ba-0d52-4a80-8571-45ca74664ec3", + ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteHybridIdentityMetadata.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteUpdateRuns.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_summaries.py similarity index 81% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_summaries.py index cdb414e001cd..d673c7da32b3 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_update_summaries.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python create_guest_agent.py + python delete_update_summaries.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.guest_agent.begin_create( + response = client.update_summaries.begin_delete( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + cluster_name="testcluster", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteUpdateSummaries.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_updates.py similarity index 81% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_updates.py index d6898d7c21fc..7ef6eea6d947 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_updates.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_guest_agent.py + python delete_updates.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,17 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.guest_agent.begin_delete( + response = client.updates.begin_delete( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/DeleteUpdates.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py deleted file mode 100644 index 58c1aeead4ab..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_machine.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python delete_virtual_machine.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.delete( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py deleted file mode 100644 index dc65b21e479d..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_network.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python delete_virtual_network.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.delete( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extend_software_assurance_benefit.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extend_software_assurance_benefit.py new file mode 100644 index 000000000000..11f630d59f4c --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extend_software_assurance_benefit.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python extend_software_assurance_benefit.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.clusters.begin_extend_software_assurance_benefit( + resource_group_name="test-rg", + cluster_name="myCluster", + software_assurance_change_request={"properties": {"softwareAssuranceIntent": "Enable"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ExtendSoftwareAssuranceBenefit.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extensions_upgrade.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extensions_upgrade.py new file mode 100644 index 000000000000..8153dc390ee3 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/extensions_upgrade.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python extensions_upgrade.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.extensions.begin_upgrade( + resource_group_name="test-rg", + cluster_name="myCluster", + arc_setting_name="default", + extension_name="MicrosoftMonitoringAgent", + extension_upgrade_parameters={"targetVersion": "1.0.18062.0"}, + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/Extensions_Upgrade.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/generate_password.py similarity index 85% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/generate_password.py index 9db228ce59e9..74b92827093f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_virtual_hard_disk.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/generate_password.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_virtual_hard_disk.py + python generate_password.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualharddisks.delete( + response = client.arc_settings.generate_password( resource_group_name="test-rg", - virtualharddisks_name="test-vhd", + cluster_name="myCluster", + arc_setting_name="default", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteVirtualHardDisk.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GeneratePassword.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py index 32efb5f49e29..8072fd632958 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_arc_setting.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetArcSetting.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetArcSetting.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py index 0813a55786e9..0c5bb9befc5e 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py index 78c3d534ade5..cc8d9a1b4ad0 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_extension.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetExtension.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py deleted file mode 100644 index 12cf0a18fbb1..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_gallery_image.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.galleryimages.retrieve( - resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py deleted file mode 100644 index b19c84c63ad5..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_machine_extension.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_machine_extension.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.get( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="CustomScriptExtension", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py deleted file mode 100644 index 44cd39991fb2..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_marketplace_gallery_image.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_marketplace_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.marketplacegalleryimages.get( - resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetMarketplaceGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py deleted file mode 100644 index 5fc34f35ef44..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_network_interface.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_network_interface.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.networkinterfaces.retrieve( - resource_group_name="test-rg", - networkinterfaces_name="test-nic", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetNetworkInterface.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_offer.py similarity index 85% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_offer.py index 0a8fcf885ff3..1994754b22af 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_network_interface.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_offer.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_network_interface.py + python get_offer.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,15 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.delete( + response = client.offers.get( resource_group_name="test-rg", - networkinterfaces_name="test-nic", + cluster_name="myCluster", + publisher_name="publisher1", + offer_name="offer1", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteNetworkInterface.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetOffer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_publisher.py similarity index 86% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_publisher.py index 70fe637e41cf..63160995339a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_machine.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_publisher.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python get_virtual_machine.py + python get_publisher.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualmachines.retrieve( + response = client.publishers.get( resource_group_name="test-rg", - virtualmachines_name="test-vm", + cluster_name="myCluster", + publisher_name="publisher1", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualMachine.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetPublisher.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_sku.py similarity index 84% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_sku.py index 80111f3d11ed..371299f06861 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_sku.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_gallery_image.py + python get_sku.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,16 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.delete( + response = client.skus.get( resource_group_name="test-rg", - galleryimages_name="test-gallery-image", + cluster_name="myCluster", + publisher_name="publisher1", + offer_name="offer1", + sku_name="sku1", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetSku.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py deleted file mode 100644 index 0c2d4cf3f8d4..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_storage_container.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_storage_container.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.storagecontainers.retrieve( - resource_group_name="test-rg", - storagecontainers_name="Default_Container", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetStorageContainer.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_runs.py similarity index 78% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_runs.py index ce27f7a95e20..286914d6f160 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/create_hybrid_identity_metadata.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_runs.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python create_hybrid_identity_metadata.py + python get_update_runs.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,18 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.hybrid_identity_metadata.create( + response = client.update_runs.get( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + update_run_name="23b779ba-0d52-4a80-8571-45ca74664ec3", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/CreateHybridIdentityMetadata.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetUpdateRuns.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_summaries.py similarity index 82% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_summaries.py index c34b5edbebfd..792d5b9f7230 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_guest_agent.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_update_summaries.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python get_guest_agent.py + python get_update_summaries.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,16 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.guest_agent.get( + response = client.update_summaries.get( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + cluster_name="testcluster", ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetGuestAgent.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetUpdateSummaries.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_updates.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_updates.py new file mode 100644 index 000000000000..5892b3e8f529 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_updates.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python get_updates.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", + ) + + response = client.updates.get( + resource_group_name="testrg", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + ) + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/GetUpdates.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py deleted file mode 100644 index 8372e05c3e79..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_hard_disk.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_virtual_hard_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualharddisks.retrieve( - resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualHardDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py deleted file mode 100644 index 3b02068c3d45..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_virtual_network.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python get_virtual_network.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.retrieve( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetVirtualNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py deleted file mode 100644 index bddf85a0e842..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/hybrid_identity_metadata_list_by_virtual_machines.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python hybrid_identity_metadata_list_by_virtual_machines.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.hybrid_identity_metadata.list_by_virtual_machines( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/HybridIdentityMetadata_ListByVirtualMachines.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/initialize_disable_process.py similarity index 83% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/initialize_disable_process.py index 34a5cd745999..31dac78bb57a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/start_virtual_machine.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/initialize_disable_process.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python start_virtual_machine.py + python initialize_disable_process.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualmachines.begin_start( + response = client.arc_settings.begin_initialize_disable_process( resource_group_name="test-rg", - virtualmachines_name="test-vm", + cluster_name="myCluster", + arc_setting_name="default", ).result() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/StartVirtualMachine.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/InitializeDisableProcess.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py index 3fb3b7317995..211d430189b5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_arc_settings_by_cluster.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListArcSettingsByCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListArcSettingsByCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py index e3370a99f21b..24d4a3de7966 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListClustersByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListClustersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py index a5d08ce8f22a..346fc959c217 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_clusters_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListClustersBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListClustersBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py index 413941b11bb2..7f647d267d76 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_extensions_by_arc_setting.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListExtensionsByArcSetting.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListExtensionsByArcSetting.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py deleted file mode 100644 index 14b66c3d97d2..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_subscription.py +++ /dev/null @@ -1,39 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_gallery_image_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.galleryimages.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListGalleryImageBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py deleted file mode 100644 index c5ad1793a5d3..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_machine_extension.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_machine_extension.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.list_by_virtual_machines( - resource_group_name="myResourceGroup", - name="myMachine", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py deleted file mode 100644 index 44b055f20edc..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_resource_group.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_marketplace_gallery_image_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.marketplacegalleryimages.list_by_resource_group( - resource_group_name="test-rg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMarketplaceGalleryImageByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py deleted file mode 100644 index 92e3f66f89d4..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_marketplace_gallery_image_by_subscription.py +++ /dev/null @@ -1,39 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_marketplace_gallery_image_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.marketplacegalleryimages.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListMarketplaceGalleryImageBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py deleted file mode 100644 index e69a28a7196a..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_subscription.py +++ /dev/null @@ -1,39 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_network_interface_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.networkinterfaces.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListNetworkInterfaceBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_cluster.py similarity index 86% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_cluster.py index ca44f9e79f62..45197412cb2b 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_gallery_image_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_cluster.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_gallery_image_by_resource_group.py + python list_offers_by_cluster.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.galleryimages.list_by_resource_group( + response = client.offers.list_by_cluster( resource_group_name="test-rg", + cluster_name="myCluster", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListGalleryImageByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListOffersByCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_publisher.py similarity index 85% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_publisher.py index 331cb1e912e4..898344df22f5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_network_interface_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_offers_by_publisher.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_network_interface_by_resource_group.py + python list_offers_by_publisher.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,15 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.networkinterfaces.list_by_resource_group( + response = client.offers.list_by_publisher( resource_group_name="test-rg", + cluster_name="myCluster", + publisher_name="publisher1", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListNetworkInterfaceByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListOffersByPublisher.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py similarity index 87% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py index 93643deff7bc..6dc188b8bbf6 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operation_by_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_operations.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_operation_by_cluster.py + python list_operations.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,13 +26,13 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.list() print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListOperationByCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_publishers_by_cluster.py similarity index 86% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_publishers_by_cluster.py index 0eb8e500dfb1..d9fc3d45d484 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_publishers_by_cluster.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_virtual_machine_by_resource_group.py + python list_publishers_by_cluster.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,14 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtualmachines.list_by_resource_group( + response = client.publishers.list_by_cluster( resource_group_name="test-rg", + cluster_name="myCluster", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualMachineByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListPublishersByCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_skus_by_offer.py similarity index 84% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_skus_by_offer.py index e9d2c854157f..b8aaa40a46be 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_resource_group.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_skus_by_offer.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_storage_container_by_resource_group.py + python list_skus_by_offer.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,16 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.storagecontainers.list_by_resource_group( + response = client.skus.list_by_offer( resource_group_name="test-rg", + cluster_name="myCluster", + publisher_name="publisher1", + offer_name="offer1", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListStorageContainerByResourceGroup.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListSkusByOffer.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py deleted file mode 100644 index a6f7685bdd55..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_storage_container_by_subscription.py +++ /dev/null @@ -1,39 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_storage_container_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.storagecontainers.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListStorageContainerBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_runs.py similarity index 80% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_runs.py index 7899e3781c76..f745eb6684ff 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/guest_agent_list_by_virtual_machines.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_runs.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python guest_agent_list_by_virtual_machines.py + python list_update_runs.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,18 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.guest_agents.list_by_virtual_machines( + response = client.update_runs.list( resource_group_name="testrg", - virtual_machine_name="ContosoVm", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GuestAgent_ListByVirtualMachines.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListUpdateRuns.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_summaries.py similarity index 80% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_summaries.py index 872e5a8bad56..65d252ece6cc 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_update_summaries.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_virtual_hard_disk_by_subscription.py + python list_update_summaries.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,14 +26,17 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.virtualharddisks.list_by_subscription() + response = client.update_summaries.list( + resource_group_name="testrg", + cluster_name="testcluster", + ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualHardDiskBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListUpdateSummaries.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_updates.py similarity index 82% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_updates.py index f716cef397f1..3b14f60626d8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_machine_by_subscription.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_updates.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python list_virtual_machine_by_subscription.py + python list_updates.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,14 +26,17 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.virtualmachines.list_by_subscription() + response = client.updates.list( + resource_group_name="testrg", + cluster_name="testcluster", + ) for item in response: print(item) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualMachineBySubscription.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/ListUpdates.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py deleted file mode 100644 index 0d516615f088..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_hard_disk_by_resource_group.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_hard_disk_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualharddisks.list_by_resource_group( - resource_group_name="test-rg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualHardDiskByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py deleted file mode 100644 index d4cd8fb1b03a..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_resource_group.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_network_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.list_by_resource_group( - resource_group_name="test-rg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualNetworkByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py deleted file mode 100644 index 1dfdd8fb5c57..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/list_virtual_network_by_subscription.py +++ /dev/null @@ -1,39 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python list_virtual_network_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/ListVirtualNetworkBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_arc_setting.py similarity index 81% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_arc_setting.py index 7e37ddce539a..bbedf2e8b9d5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/delete_marketplace_gallery_image.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_arc_setting.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python delete_marketplace_gallery_image.py + python patch_arc_setting.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,15 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.marketplacegalleryimages.delete( + response = client.arc_settings.update( resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", + cluster_name="myCluster", + arc_setting_name="default", + arc_setting={"properties": {"connectivityProperties": {"enabled": True}}}, ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/DeleteMarketplaceGalleryImage.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PatchArcSetting.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py index 1bbffe3050d1..89e0d1ac618a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/patch_extension.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PatchExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PatchExtension.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/post_updates.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/post_updates.py new file mode 100644 index 000000000000..1a3d6245b6c2 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/post_updates.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python post_updates.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", + ) + + response = client.updates.begin_post( + resource_group_name="testrg", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PostUpdates.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py index bfff134a861b..bd64f7458752 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_extension.py @@ -37,6 +37,7 @@ def main(): extension={ "properties": { "extensionParameters": { + "enableAutomaticUpgrade": False, "protectedSettings": {"workspaceKey": "xx"}, "publisher": "Microsoft.Compute", "settings": {"workspaceId": "xx"}, @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutExtension.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PutExtension.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py deleted file mode 100644 index 64a41416b1b3..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_gallery_image.py +++ /dev/null @@ -1,49 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.galleryimages.begin_create_or_update( - resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - galleryimages={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": {"containerName": "Default_Container", "imagePath": "C:\\test.vhdx"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py deleted file mode 100644 index 585c0dfe58fd..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_machine_extension.py +++ /dev/null @@ -1,51 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_machine_extension.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_create_or_update( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="CustomScriptExtension", - extension_parameters={ - "location": "eastus2euap", - "properties": { - "publisher": "Microsoft.Compute", - "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -gt 10000 }"'}, - "type": "CustomScriptExtension", - "typeHandlerVersion": "1.10", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py deleted file mode 100644 index 0f4deb469f58..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_marketplace_gallery_image.py +++ /dev/null @@ -1,56 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_marketplace_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.marketplacegalleryimages.begin_create_or_update( - resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplace-gallery-image", - marketplacegalleryimages={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": { - "cloudInitDataSource": "Azure", - "containerName": "Default_Container", - "hyperVGeneration": "V1", - "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, - "osType": "Windows", - "version": {"name": "1.0.0"}, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutMarketplaceGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py deleted file mode 100644 index 660b420c4032..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_network_interface.py +++ /dev/null @@ -1,51 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_network_interface.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.networkinterfaces.begin_create_or_update( - resource_group_name="test-rg", - networkinterfaces_name="test-nic", - networkinterfaces={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": { - "ipConfigurations": [{"name": "ipconfig-sample", "properties": {"subnet": {"id": "test-vnet"}}}] - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutNetworkInterface.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py deleted file mode 100644 index 98e1be084af2..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_storage_container.py +++ /dev/null @@ -1,49 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_storage_container.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.storagecontainers.begin_create_or_update( - resource_group_name="test-rg", - storagecontainers_name="Default_Container", - storagecontainers={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": {"path": "C:\\container_storage"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutStorageContainer.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_runs.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_runs.py new file mode 100644 index 000000000000..a4aa0ccf004d --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_runs.py @@ -0,0 +1,68 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python put_update_runs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", + ) + + response = client.update_runs.put( + resource_group_name="testrg", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + update_run_name="23b779ba-0d52-4a80-8571-45ca74664ec3", + update_runs_properties={ + "properties": { + "progress": { + "description": "Update Azure Stack.", + "endTimeUtc": "2022-04-06T13:58:42.969006+00:00", + "errorMessage": "", + "lastUpdatedTimeUtc": "2022-04-06T13:58:42.969006+00:00", + "name": "Unnamed step", + "startTimeUtc": "2022-04-06T01:36:33.3876751+00:00", + "status": "Success", + "steps": [ + { + "description": "Prepare for SSU update", + "endTimeUtc": "2022-04-06T01:37:16.8728314+00:00", + "errorMessage": "", + "lastUpdatedTimeUtc": "2022-04-06T01:37:16.8728314+00:00", + "name": "PreUpdate Cloud", + "startTimeUtc": "2022-04-06T01:36:33.3876751+00:00", + "status": "Success", + "steps": [], + } + ], + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PutUpdateRuns.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_summaries.py similarity index 66% rename from sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py rename to sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_summaries.py index 7e54484d1287..3fbda3cac7a5 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/get_hybrid_identity_metadata.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_update_summaries.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-azurestackhci # USAGE - python get_hybrid_identity_metadata.py + python put_update_summaries.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,26 @@ def main(): client = AzureStackHCIClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", ) - response = client.hybrid_identity_metadata.get( + response = client.update_summaries.put( resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", + cluster_name="testcluster", + update_location_properties={ + "properties": { + "currentVersion": "4.2203.2.32", + "hardwareModel": "PowerEdge R730xd", + "lastChecked": "2022-04-07T18:04:07Z", + "lastUpdated": "2022-04-06T14:08:18.254Z", + "oemFamily": "DellEMC", + "state": "AppliedSuccessfully", + } + }, ) print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/GetHybridIdentityMetadata.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PutUpdateSummaries.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_updates.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_updates.py new file mode 100644 index 000000000000..32151692a85a --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_updates.py @@ -0,0 +1,69 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python put_updates.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="b8d594e5-51f3-4c11-9c54-a7771b81c712", + ) + + response = client.updates.put( + resource_group_name="testrg", + cluster_name="testcluster", + update_name="Microsoft4.2203.2.32", + update_properties={ + "properties": { + "additionalProperties": "additional properties", + "availabilityType": "Local", + "description": "AzS Update 4.2203.2.32", + "displayName": "AzS Update - 4.2203.2.32", + "installedDate": "2022-04-06T14:08:18.254Z", + "packagePath": "\\\\SU1FileServer\\SU1_Infrastructure_2\\Updates\\Packages\\Microsoft4.2203.2.32", + "packageSizeInMb": 18858, + "packageType": "Infrastructure", + "prerequisites": [ + { + "packageName": "update package name", + "updateType": "update type", + "version": "prerequisite version", + } + ], + "publisher": "Microsoft", + "releaseLink": "https://docs.microsoft.com/azure-stack/operator/release-notes?view=azs-2203", + "state": "Installed", + "updateStateProperties": { + "notifyMessage": "Brief message with instructions for updates of AvailabilityType Notify", + "progressPercentage": 0, + }, + "version": "4.2203.2.32", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/PutUpdates.json +if __name__ == "__main__": + main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py deleted file mode 100644 index 361980ed369a..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_hard_disk.py +++ /dev/null @@ -1,49 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_virtual_hard_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualharddisks.begin_create_or_update( - resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - virtualharddisks={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": {"diskSizeBytes": 32}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualHardDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py deleted file mode 100644 index d5d1bc038f8b..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_gallery_image.py +++ /dev/null @@ -1,60 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_virtual_machine_with_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": { - "hardwareProfile": {"vmSize": "Default"}, - "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, - "osProfile": {"adminPassword": "password", "adminUsername": "localadmin", "computerName": "luamaster"}, - "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, - "storageProfile": { - "imageReference": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryimages/test-gallery-image" - }, - "vmConfigContainerName": "Default_Container", - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py deleted file mode 100644 index 2de1161921ba..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_marketplace_gallery_image.py +++ /dev/null @@ -1,60 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_virtual_machine_with_marketplace_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": { - "hardwareProfile": {"vmSize": "Default"}, - "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, - "osProfile": {"adminPassword": "password", "adminUsername": "localadmin", "computerName": "luamaster"}, - "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, - "storageProfile": { - "imageReference": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/test-marketplace-gallery-image" - }, - "vmConfigContainerName": "Default_Container", - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithMarketplaceGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py deleted file mode 100644 index 4957f962e92f..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_machine_with_os_disk.py +++ /dev/null @@ -1,59 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_virtual_machine_with_os_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.begin_create_or_update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": { - "hardwareProfile": {"vmSize": "Default"}, - "networkProfile": {"networkInterfaces": [{"id": "test-nic"}]}, - "securityProfile": {"enableTPM": True, "uefiSettings": {"secureBootEnabled": True}}, - "storageProfile": { - "osDisk": { - "id": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualharddisks/test-vhd" - }, - "vmConfigContainerName": "Default_Container", - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualMachineWithOsDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py deleted file mode 100644 index 3cc3f7193cb8..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/put_virtual_network.py +++ /dev/null @@ -1,49 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python put_virtual_network.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.begin_create_or_update( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - virtualnetworks={ - "extendedLocation": { - "name": "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location", - "type": "CustomLocation", - }, - "location": "West US2", - "properties": {"networkType": "Transparent"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/PutVirtualNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py index 957cd6e86b9e..cfa7b68015c7 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_cluster.py @@ -33,9 +33,10 @@ def main(): resource_group_name="test-rg", cluster_name="myCluster", cluster={ + "identity": {"type": "SystemAssigned"}, "properties": { "cloudManagementEndpoint": "https://98294836-31be-4668-aeae-698667faf99b.waconazure.com", - "desiredProperties": {"diagnosticLevel": "Required", "windowsServerSubscription": "Enabled"}, + "desiredProperties": {"diagnosticLevel": "Basic", "windowsServerSubscription": "Enabled"}, }, "tags": {"tag1": "value1", "tag2": "value2"}, }, @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateCluster.json +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/UpdateCluster.json if __name__ == "__main__": main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py deleted file mode 100644 index 4039891a5e76..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_gallery_image.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.galleryimages.update( - resource_group_name="test-rg", - galleryimages_name="test-gallery-image", - galleryimages={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py deleted file mode 100644 index c82bcc1d6f34..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_machine_extension.py +++ /dev/null @@ -1,50 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_machine_extension.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_update( - resource_group_name="myResourceGroup", - name="myMachine", - extension_name="CustomScriptExtension", - extension_parameters={ - "properties": { - "publisher": "Microsoft.Compute", - "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -lt 100 }"'}, - "type": "CustomScriptExtension", - "typeHandlerVersion": "1.10", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateMachineExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py deleted file mode 100644 index 6268806c8025..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_marketplace_gallery_image.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_marketplace_gallery_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.marketplacegalleryimages.update( - resource_group_name="test-rg", - marketplacegalleryimages_name="test-marketplce-gallery-image", - marketplacegalleryimages={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateMarketplaceGalleryImage.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py deleted file mode 100644 index 2a612da3da3c..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_network_interface.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_network_interface.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.networkinterfaces.update( - resource_group_name="test-rg", - networkinterfaces_name="test-nic", - networkinterfaces={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateNetworkInterface.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py deleted file mode 100644 index 4280b5eb143a..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_storage_container.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_storage_container.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.storagecontainers.update( - resource_group_name="test-rg", - storagecontainers_name="Default_Container", - storagecontainers={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateStorageContainer.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py deleted file mode 100644 index 204c8e16605d..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_hard_disk.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_virtual_hard_disk.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualharddisks.update( - resource_group_name="test-rg", - virtualharddisks_name="test-vhd", - virtualharddisks={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualHardDisk.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py deleted file mode 100644 index 96ddd6cefafe..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_machine.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_virtual_machine.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualmachines.update( - resource_group_name="test-rg", - virtualmachines_name="test-vm", - virtualmachines={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py deleted file mode 100644 index d26b563f3cd9..000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/update_virtual_network.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential -from azure.mgmt.azurestackhci import AzureStackHCIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-azurestackhci -# USAGE - python update_virtual_network.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureStackHCIClient( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtualnetworks.update( - resource_group_name="test-rg", - virtualnetworks_name="test-vnet", - virtualnetworks={"tags": {"additionalProperties": "sample"}}, - ) - print(response) - - -# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2021-09-01-preview/examples/UpdateVirtualNetwork.json -if __name__ == "__main__": - main() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/upload_certificate.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/upload_certificate.py new file mode 100644 index 000000000000..985cf3e5058a --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/generated_samples/upload_certificate.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.azurestackhci import AzureStackHCIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurestackhci +# USAGE + python upload_certificate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureStackHCIClient( + credential=DefaultAzureCredential(), + subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + ) + + response = client.clusters.begin_upload_certificate( + resource_group_name="test-rg", + cluster_name="myCluster", + upload_certificate_request={"properties": {"certificates": ["base64cert", "base64cert"]}}, + ).result() + print(response) + + +# x-ms-original-file: specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2023-03-01/examples/UploadCertificate.json +if __name__ == "__main__": + main()