From ec4467dfd46ebb7d3e2e77465481833f2bfb11f4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 19 Sep 2024 20:18:53 +0000 Subject: [PATCH] CodeGen from PR 30598 in Azure/azure-rest-api-specs Merge ddf30d631be7fcaf4994e8480d531426d1525048 into ab848447cdbc154106aae2c9226093227814d337 --- .../README.md | 4 +- .../_meta.json | 10 +- .../desktopvirtualization/_configuration.py | 15 +- .../_desktop_virtualization_mgmt_client.py | 98 +- .../desktopvirtualization/_serialization.py | 94 +- .../mgmt/desktopvirtualization/_vendor.py | 16 - .../mgmt/desktopvirtualization/_version.py | 2 +- .../aio/_configuration.py | 15 +- .../_desktop_virtualization_mgmt_client.py | 100 +- .../aio/operations/__init__.py | 18 + ..._session_host_configurations_operations.py | 203 + .../_app_attach_package_info_operations.py | 220 + .../_app_attach_package_operations.py | 617 +++ .../_application_groups_operations.py | 176 +- .../operations/_applications_operations.py | 149 +- ..._control_session_host_update_operations.py | 255 + .../aio/operations/_desktops_operations.py | 98 +- .../aio/operations/_host_pools_operations.py | 256 +- ...initiate_session_host_update_operations.py | 190 + .../aio/operations/_msix_images_operations.py | 54 +- .../operations/_msix_packages_operations.py | 149 +- .../aio/operations/_operations.py | 37 +- ...private_endpoint_connections_operations.py | 215 +- .../_private_link_resources_operations.py | 65 +- ...ling_plan_personal_schedules_operations.py | 149 +- ...caling_plan_pooled_schedules_operations.py | 149 +- .../operations/_scaling_plans_operations.py | 201 +- ..._session_host_configurations_operations.py | 647 +++ .../_session_host_managements_operations.py | 471 ++ ...st_managements_update_status_operations.py | 112 + .../operations/_session_host_operations.py | 111 + .../operations/_session_hosts_operations.py | 117 +- .../_start_menu_items_operations.py | 39 +- .../operations/_user_sessions_operations.py | 152 +- .../aio/operations/_workspaces_operations.py | 181 +- .../desktopvirtualization/models/__init__.py | 148 +- ...esktop_virtualization_mgmt_client_enums.py | 287 +- .../models/_models_py3.py | 4184 ++++++++++++++--- .../operations/__init__.py | 18 + ..._session_host_configurations_operations.py | 272 ++ .../_app_attach_package_info_operations.py | 258 + .../_app_attach_package_operations.py | 843 ++++ .../_application_groups_operations.py | 228 +- .../operations/_applications_operations.py | 220 +- ..._control_session_host_update_operations.py | 296 ++ .../operations/_desktops_operations.py | 139 +- .../operations/_host_pools_operations.py | 340 +- ...initiate_session_host_update_operations.py | 231 + .../operations/_msix_images_operations.py | 62 +- .../operations/_msix_packages_operations.py | 217 +- .../operations/_operations.py | 39 +- ...private_endpoint_connections_operations.py | 279 +- .../_private_link_resources_operations.py | 81 +- ...ling_plan_personal_schedules_operations.py | 217 +- ...caling_plan_pooled_schedules_operations.py | 217 +- .../operations/_scaling_plans_operations.py | 249 +- ..._session_host_configurations_operations.py | 787 ++++ .../_session_host_managements_operations.py | 614 +++ ...st_managements_update_status_operations.py | 150 + .../operations/_session_host_operations.py | 152 + .../operations/_session_hosts_operations.py | 166 +- .../_start_menu_items_operations.py | 50 +- .../operations/_user_sessions_operations.py | 220 +- .../operations/_workspaces_operations.py | 221 +- .../active_session_host_configurations_get.py | 42 + ...n_host_configurations_list_by_host_pool.py | 43 + .../app_attach_package_create.py | 85 + .../app_attach_package_delete.py | 41 + .../app_attach_package_get.py | 42 + .../app_attach_package_info_import_post.py | 44 + ..._attach_package_list_by_resource_group.py} | 9 +- ...app_attach_package_list_by_subscription.py | 40 + .../app_attach_package_update.py | 42 + .../generated_samples/application_create.py | 3 +- .../generated_samples/application_delete.py | 3 +- .../generated_samples/application_get.py | 3 +- .../application_group_create.py | 3 +- .../application_group_delete.py | 3 +- .../application_group_get.py | 3 +- ...pplication_group_list_by_resource_group.py | 3 +- .../application_group_list_by_subscription.py | 3 +- .../application_group_update.py | 3 +- .../generated_samples/application_list.py | 3 +- .../generated_samples/application_update.py | 3 +- .../generated_samples/desktop_get.py | 3 +- .../generated_samples/desktop_list.py | 3 +- .../generated_samples/desktop_update.py | 3 +- .../generated_samples/host_pool_create.py | 8 +- .../generated_samples/host_pool_delete.py | 3 +- .../generated_samples/host_pool_get.py | 3 +- .../generated_samples/host_pool_list.py | 3 +- .../host_pool_list_by_resource_group.py | 3 +- .../generated_samples/host_pool_update.py | 3 +- ...host_pools_list_registration_token_post.py | 42 + ..._pools_retrieve_registration_token_post.py | 3 +- .../generated_samples/msix_package_create.py | 3 +- .../generated_samples/msix_package_delete.py | 3 +- .../generated_samples/msix_package_get.py | 3 +- .../generated_samples/msix_package_list.py | 3 +- .../generated_samples/msix_package_update.py | 3 +- .../operation_description_list.py | 3 +- ...endpoint_connection_delete_by_host_pool.py | 3 +- ...endpoint_connection_delete_by_workspace.py | 3 +- ...te_endpoint_connection_get_by_host_pool.py | 3 +- ...te_endpoint_connection_get_by_workspace.py | 3 +- ...e_endpoint_connection_list_by_host_pool.py | 3 +- ...e_endpoint_connection_list_by_workspace.py | 3 +- ...endpoint_connection_update_by_host_pool.py | 3 +- ...endpoint_connection_update_by_workspace.py | 3 +- ...rivate_link_resources_list_by_host_pool.py | 3 +- ...rivate_link_resources_list_by_workspace.py | 3 +- .../generated_samples/scaling_plan_create.py | 3 +- .../generated_samples/scaling_plan_delete.py | 3 +- .../generated_samples/scaling_plan_get.py | 3 +- .../scaling_plan_list_by_host_pool.py | 3 +- .../scaling_plan_list_by_resource_group.py | 3 +- .../scaling_plan_list_by_subscription.py | 3 +- .../scaling_plan_personal_schedule_create.py | 3 +- .../scaling_plan_personal_schedule_delete.py | 3 +- .../scaling_plan_personal_schedule_get.py | 3 +- .../scaling_plan_personal_schedule_list.py | 3 +- .../scaling_plan_personal_schedule_update.py | 3 +- .../scaling_plan_pooled_schedule_create.py | 3 +- .../scaling_plan_pooled_schedule_delete.py | 3 +- .../scaling_plan_pooled_schedule_get.py | 3 +- .../scaling_plan_pooled_schedule_list.py | 3 +- .../scaling_plan_pooled_schedule_update.py | 3 +- .../generated_samples/scaling_plan_update.py | 3 +- .../session_host_configurations_create.py | 92 + .../session_host_configurations_get.py | 42 + ...n_host_configurations_list_by_host_pool.py | 43 + .../session_host_configurations_update.py | 42 + .../generated_samples/session_host_delete.py | 3 +- .../generated_samples/session_host_get.py | 3 +- .../generated_samples/session_host_list.py | 3 +- ...ements_control_session_host_update_post.py | 42 + .../session_host_managements_create.py | 53 + .../session_host_managements_get.py | 42 + ...sion_host_managements_list_by_host_pool.py | 43 + .../session_host_managements_update.py | 42 + ...t_managements_update_session_hosts_post.py | 41 + ...sion_host_managements_update_status_get.py | 42 + .../session_host_retry_provisioning_post.py | 42 + .../generated_samples/session_host_update.py | 3 +- .../generated_samples/start_menu_item_list.py | 3 +- .../generated_samples/user_session_delete.py | 3 +- .../user_session_disconnect_post.py | 3 +- .../generated_samples/user_session_get.py | 3 +- .../generated_samples/user_session_list.py | 3 +- .../user_session_list_by_host_pool.py | 3 +- .../user_session_send_message_post.py | 3 +- .../generated_samples/workspace_create.py | 3 +- .../generated_samples/workspace_delete.py | 3 +- .../generated_samples/workspace_get.py | 3 +- .../workspace_list_by_resource_group.py | 3 +- .../workspace_list_by_subscription.py | 3 +- .../generated_samples/workspace_update.py | 3 +- .../generated_tests/conftest.py | 43 + ..._session_host_configurations_operations.py | 43 + ...on_host_configurations_operations_async.py | 44 + ...mgmt_app_attach_package_info_operations.py | 32 + ...pp_attach_package_info_operations_async.py | 33 + ...tion_mgmt_app_attach_package_operations.py | 140 + ...gmt_app_attach_package_operations_async.py | 141 + ...tion_mgmt_application_groups_operations.py | 122 + ...gmt_application_groups_operations_async.py | 123 + ...ualization_mgmt_applications_operations.py | 110 + ...tion_mgmt_applications_operations_async.py | 111 + ..._control_session_host_update_operations.py | 32 + ...ol_session_host_update_operations_async.py | 35 + ...virtualization_mgmt_desktops_operations.py | 57 + ...lization_mgmt_desktops_operations_async.py | 58 + ...rtualization_mgmt_host_pools_operations.py | 198 + ...zation_mgmt_host_pools_operations_async.py | 199 + ...initiate_session_host_update_operations.py | 31 + ...te_session_host_update_operations_async.py | 32 + ...tualization_mgmt_msix_images_operations.py | 32 + ...ation_mgmt_msix_images_operations_async.py | 33 + ...alization_mgmt_msix_packages_operations.py | 117 + ...ion_mgmt_msix_packages_operations_async.py | 118 + ..._desktop_virtualization_mgmt_operations.py | 29 + ...op_virtualization_mgmt_operations_async.py | 30 + ...private_endpoint_connections_operations.py | 155 + ...e_endpoint_connections_operations_async.py | 156 + ..._mgmt_private_link_resources_operations.py | 43 + ...private_link_resources_operations_async.py | 44 + ...ling_plan_personal_schedules_operations.py | 122 + ...lan_personal_schedules_operations_async.py | 123 + ...caling_plan_pooled_schedules_operations.py | 113 + ..._plan_pooled_schedules_operations_async.py | 114 + ...alization_mgmt_scaling_plans_operations.py | 155 + ...ion_mgmt_scaling_plans_operations_async.py | 156 + ..._session_host_configurations_operations.py | 109 + ...on_host_configurations_operations_async.py | 117 + ...gmt_session_host_managements_operations.py | 82 + ...ssion_host_managements_operations_async.py | 83 + ...st_managements_update_status_operations.py | 31 + ...agements_update_status_operations_async.py | 32 + ...ualization_mgmt_session_host_operations.py | 32 + ...tion_mgmt_session_host_operations_async.py | 33 + ...alization_mgmt_session_hosts_operations.py | 70 + ...ion_mgmt_session_hosts_operations_async.py | 71 + ...zation_mgmt_start_menu_items_operations.py | 31 + ..._mgmt_start_menu_items_operations_async.py | 32 + ...alization_mgmt_user_sessions_operations.py | 100 + ...ion_mgmt_user_sessions_operations_async.py | 101 + ...rtualization_mgmt_workspaces_operations.py | 143 + ...zation_mgmt_workspaces_operations_async.py | 144 + .../azure-mgmt-desktopvirtualization/setup.py | 12 +- 209 files changed, 18145 insertions(+), 3986 deletions(-) delete mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_image_expand_post.py => app_attach_package_list_by_resource_group.py} (84%) create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md index 44a468fb8921..3de4fd61d2fb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Desktop Virtualization Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index 72a9c7e96f82..d1996e7c3b9b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "commit": "15ba5b8a954afb74a6bb8902038835f0cddb9930", + "commit": "23e5e86c0bd051377f1f1e3721affa3635dcaea3", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.19.0", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/desktopvirtualization/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 --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/desktopvirtualization/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py index a536063e4548..26bc7377b7b5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for DesktopVirtualizationMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-08-preview". 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(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-08-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-desktopvirtualization/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py index 7098982a4ab5..80a071e7a547 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py @@ -8,18 +8,26 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import DesktopVirtualizationMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + ActiveSessionHostConfigurationsOperations, + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -28,6 +36,10 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -71,23 +83,52 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.operations.SessionHostConfigurationsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( @@ -100,7 +141,25 @@ def __init__( self._config = DesktopVirtualizationMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -128,12 +187,37 @@ def __init__( self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -153,12 +237,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "DesktopVirtualizationMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py index 4bae2292227b..8139854b97bb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[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__) @@ -340,7 +335,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: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +663,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +749,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1365,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1444,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1481,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py index cee48f65d70f..a89c09922ea2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for DesktopVirtualizationMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class DesktopVirtualizationMgmtClientConfiguration(Configuration): # pylint: di :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-08-preview". 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(DesktopVirtualizationMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-05") + api_version: str = kwargs.pop("api_version", "2024-08-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-desktopvirtualization/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py index 652ec8ef22ef..dbba7b130c9a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py @@ -8,18 +8,26 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import DesktopVirtualizationMgmtClientConfiguration from .operations import ( + ActiveSessionHostConfigurationsOperations, + AppAttachPackageInfoOperations, + AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -28,6 +36,10 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -72,23 +84,52 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostConfigurationsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.aio.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.aio.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageInfoOperations :ivar msix_images: MsixImagesOperations operations :vartype msix_images: azure.mgmt.desktopvirtualization.aio.operations.MsixImagesOperations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageOperations :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. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-09-05". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( @@ -101,7 +142,25 @@ def __init__( self._config = DesktopVirtualizationMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -129,12 +188,39 @@ def __init__( self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -154,12 +240,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DesktopVirtualizationMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py index 975df17adf61..8ea21f89ab23 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py @@ -18,10 +18,19 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,10 +49,19 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostConfigurationsOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..d86a8a3708b1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,203 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, 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.rest import AsyncHttpResponse, 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 ...operations._active_session_host_configurations_operations import ( + build_get_request, + build_list_by_host_pool_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ActiveSessionHostConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` 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, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :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.ActiveSessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ActiveSessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..508d45e2de01 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py @@ -0,0 +1,220 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, 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.rest import AsyncHttpResponse, 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 ...operations._app_attach_package_info_operations import build_import_method_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` 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") + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO[bytes] type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO[bytes] + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..3560a484016e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py @@ -0,0 +1,617 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, 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.rest import AsyncHttpResponse, 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 ...operations._app_attach_package_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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` 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, app_attach_package_name: str, **kwargs: Any + ) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO[bytes]], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO[bytes] type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or + IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = 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, 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) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + force=force, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO[bytes] type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = 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("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, package owner name, and custom data. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) + + @distributed_trace + def list_by_subscription( + self, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, + resource group, host pool, package owner name, and custom data. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py index 10f2d1388b13..85b9c639ab72 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._application_groups_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,12 +75,11 @@ async def get( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,21 +93,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -114,16 +114,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -147,7 +143,6 @@ async def create_or_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: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -158,7 +153,7 @@ async def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: IO, + application_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -171,11 +166,10 @@ async def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Required. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -186,7 +180,7 @@ async def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: Union[_models.ApplicationGroup, IO], + application_group: Union[_models.ApplicationGroup, IO[bytes]], **kwargs: Any ) -> _models.ApplicationGroup: """Create or update an applicationGroup. @@ -197,17 +191,13 @@ async def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroup type or a IO type. Required. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup 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 + ApplicationGroup type or a IO[bytes] type. Required. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +220,7 @@ async def create_or_update( else: _json = self._serialize.body(application_group, "ApplicationGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -238,16 +228,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,21 +244,13 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ApplicationGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, **kwargs: Any @@ -282,12 +262,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,21 +280,19 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,11 +302,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -354,7 +327,6 @@ async def 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: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -365,7 +337,7 @@ async def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[IO] = None, + application_group: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -379,11 +351,10 @@ async def update( :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Default value is None. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -394,7 +365,7 @@ async def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[Union[_models.ApplicationGroupPatch, IO]] = None, + application_group: Optional[Union[_models.ApplicationGroupPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApplicationGroup: """Update an applicationGroup. @@ -405,17 +376,14 @@ async def update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroupPatch type or a IO type. Default value is None. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch 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 + ApplicationGroupPatch type or a IO[bytes] type. Default value is None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or + IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +409,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -449,16 +417,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -467,16 +433,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -502,7 +464,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] @@ -514,7 +475,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -525,7 +486,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, @@ -533,12 +494,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -550,13 +509,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -566,11 +524,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,10 +540,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } - @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, **kwargs: Any @@ -595,7 +549,6 @@ def list_by_subscription( :param filter: OData filter expression. Valid properties for filtering are applicationGroupType. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] @@ -607,7 +560,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,16 +571,14 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -639,13 +590,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -655,11 +605,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -670,7 +620,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py index c6a2f7602535..d21375e40c45 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._applications_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,12 +77,11 @@ async def get( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,22 +95,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,16 +117,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -154,7 +150,6 @@ async def create_or_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: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +161,7 @@ async def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: IO, + application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +177,10 @@ async def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Required. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +192,7 @@ async def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: Union[_models.Application, IO], + application: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> _models.Application: """Create or update an application. @@ -212,17 +206,13 @@ async def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a Application type or - a IO type. Required. - :type application: ~azure.mgmt.desktopvirtualization.models.Application 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 + a IO[bytes] type. Required. + :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +235,7 @@ async def create_or_update( else: _json = self._serialize.body(application, "Application") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -254,16 +244,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,21 +260,13 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -301,12 +281,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :param application_name: The name of the application within the specified application group. Required. :type application_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,22 +299,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,11 +322,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +350,6 @@ async def 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: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +361,7 @@ async def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[IO] = None, + application: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +377,10 @@ async def update( Required. :type application_name: str :param application: Object containing Application definitions. Default value is None. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +392,7 @@ async def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[Union[_models.ApplicationPatch, IO]] = None, + application: Optional[Union[_models.ApplicationPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Application: """Update an application. @@ -435,17 +406,13 @@ async def update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO type. Default value is None. - :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch 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 + type or a IO[bytes] type. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +438,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -480,16 +447,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,16 +463,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +493,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Application] @@ -544,7 +504,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +515,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -563,12 +523,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +538,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationList", pipeline_response) @@ -596,11 +553,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +568,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..45d92ea1e068 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py @@ -0,0 +1,255 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._control_session_host_update_operations import build_post_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` 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 _post_initial( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(host_pool_update_control_parameter, (IOBase, bytes)): + _content = host_pool_update_control_parameter + else: + _json = self._serialize.body(host_pool_update_control_parameter, "HostPoolUpdateControlParameter") + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: _models.HostPoolUpdateControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Is either a HostPoolUpdateControlParameter type or a IO[bytes] type. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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._post_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_update_control_parameter=host_pool_update_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py index c79a581b8667..fb1790ae3681 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,17 +21,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._desktops_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,12 +70,11 @@ async def get( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,22 +88,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Desktop] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,16 +110,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Desktop", pipeline_response) + deserialized = self._deserialize("Desktop", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @overload async def update( @@ -146,7 +142,6 @@ async def 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: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -158,7 +153,7 @@ async def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[IO] = None, + desktop: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -173,11 +168,10 @@ async def update( :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str :param desktop: Object containing Desktop definitions. Default value is None. - :type desktop: IO + :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -189,7 +183,7 @@ async def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[Union[_models.DesktopPatch, IO]] = None, + desktop: Optional[Union[_models.DesktopPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Desktop: """Update a desktop. @@ -201,18 +195,14 @@ async def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a IO - type. Default value is None. - :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch 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 + :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a + IO[bytes] type. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO[bytes] :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +228,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, @@ -247,16 +237,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -265,16 +253,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Desktop", pipeline_response) + deserialized = self._deserialize("Desktop", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -299,7 +283,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Desktop or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Desktop] @@ -311,7 +294,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DesktopList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +305,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -330,12 +313,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -347,13 +328,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DesktopList", pipeline_response) @@ -363,11 +343,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,7 +358,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py index e43c8f1f9c72..6c02ad1f5973 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,25 +21,28 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._host_pools_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, + build_list_registration_tokens_request, build_list_request, build_retrieve_registration_token_request, build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,12 +75,11 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,21 +93,19 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPool] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,16 +114,12 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -146,7 +143,6 @@ async def create_or_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: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -157,7 +153,7 @@ async def create_or_update( self, resource_group_name: str, host_pool_name: str, - host_pool: IO, + host_pool: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -170,11 +166,10 @@ async def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Required. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -182,7 +177,11 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, host_pool_name: str, host_pool: Union[_models.HostPool, IO], **kwargs: Any + self, + resource_group_name: str, + host_pool_name: str, + host_pool: Union[_models.HostPool, IO[bytes]], + **kwargs: Any ) -> _models.HostPool: """Create or update a host pool. @@ -191,18 +190,14 @@ async def create_or_update( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a IO - type. Required. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool 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 + :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a + IO[bytes] type. Required. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +220,7 @@ async def create_or_update( else: _json = self._serialize.body(host_pool, "HostPool") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -233,16 +228,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,21 +244,13 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("HostPool", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any @@ -279,12 +264,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type host_pool_name: str :param force: Force flag to delete sessionHost. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,22 +282,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,11 +305,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -351,7 +329,6 @@ async def 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: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -362,7 +339,7 @@ async def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[IO] = None, + host_pool: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -375,11 +352,10 @@ async def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Default value is None. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -390,7 +366,7 @@ async def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[Union[_models.HostPoolPatch, IO]] = None, + host_pool: Optional[Union[_models.HostPoolPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.HostPool: """Update a host pool. @@ -401,17 +377,13 @@ async def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Is either a HostPoolPatch type or a - IO type. Default value is None. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch 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 + IO[bytes] type. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +409,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -445,16 +417,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -463,16 +433,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -494,7 +460,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] @@ -506,7 +471,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,19 +482,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -541,13 +504,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -557,11 +519,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,10 +535,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools" - } - @distributed_trace def list( self, @@ -593,7 +551,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] @@ -605,7 +562,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,18 +573,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -639,13 +594,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -655,11 +609,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -671,8 +625,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} - @distributed_trace_async async def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any @@ -684,12 +636,11 @@ async def retrieve_registration_token( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,21 +654,19 @@ async def retrieve_registration_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - request = build_retrieve_registration_token_request( + _request = build_retrieve_registration_token_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_registration_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,13 +675,66 @@ async def retrieve_registration_token( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationInfo", pipeline_response) + deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_registration_tokens( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.RegistrationTokenList: + """Operation to list the RegistrationTokens associated with the HostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: RegistrationTokenList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationTokenList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RegistrationTokenList] = kwargs.pop("cls", None) + + _request = build_list_registration_tokens_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response - return deserialized + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) - retrieve_registration_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken" - } + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..9894f5285813 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,190 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._initiate_session_host_update_operations import build_post_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` 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") + + @overload + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO[bytes] type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = 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) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py index 804795747ad5..e773c50662e3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,16 +21,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request from ...operations._msix_images_operations import build_expand_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,6 @@ def expand( :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: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -87,7 +89,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO, + msix_image_uri: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -100,11 +102,10 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Required. - :type msix_image_uri: IO + :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -116,7 +117,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO], + msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], **kwargs: Any ) -> AsyncIterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. @@ -127,12 +128,8 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO type. Required. - :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI 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 + IO[bytes] type. Required. + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO[bytes] :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] @@ -145,7 +142,7 @@ def expand( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpandMsixImageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +160,7 @@ def expand( def prepare_request(next_link=None): if not next_link: - request = build_expand_request( + _request = build_expand_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -171,12 +168,10 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.expand.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -188,13 +183,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) @@ -204,11 +198,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +213,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - expand.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py index a4957ef54d9b..600fd5c5dc8d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._msix_packages_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,12 +77,11 @@ async def get( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,22 +95,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,16 +117,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -154,7 +150,6 @@ async def create_or_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: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +161,7 @@ async def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: IO, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +177,10 @@ async def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Required. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +192,7 @@ async def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Union[_models.MSIXPackage, IO], + msix_package: Union[_models.MSIXPackage, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Create or update a MSIX package. @@ -212,17 +206,13 @@ async def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackage type - or a IO type. Required. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage 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 + or a IO[bytes] type. Required. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +235,7 @@ async def create_or_update( else: _json = self._serialize.body(msix_package, "MSIXPackage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -254,16 +244,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,21 +260,13 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MSIXPackage", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -301,12 +281,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,22 +299,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,11 +322,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +350,6 @@ async def 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: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +361,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO] = None, + msix_package: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +377,10 @@ async def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Default value is None. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +392,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO]] = None, + msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -435,17 +406,13 @@ async def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO type. Default value is None. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch 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 + type or a IO[bytes] type. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +438,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -480,16 +447,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,16 +463,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +493,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackage] @@ -544,7 +504,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +515,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -563,12 +523,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +538,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("MSIXPackageList", pipeline_response) @@ -596,11 +553,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +568,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py index 0c255d1ee075..c48bca8240e1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: """List all of the available operations the Desktop Virtualization resource provider supports. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) :rtype: @@ -69,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,14 +82,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -99,13 +99,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) @@ -115,11 +114,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +129,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.DesktopVirtualization/operations"} diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py index 9add67da79b4..1a2a1c1208c8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._private_endpoint_connections_operations import ( build_delete_by_host_pool_request, build_delete_by_workspace_request, @@ -40,6 +39,10 @@ build_update_by_workspace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -87,7 +89,7 @@ def list_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResultWithSystemData] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,17 +100,15 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -136,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,10 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace_async async def get_by_workspace( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -170,12 +165,11 @@ async def get_by_workspace( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,22 +183,20 @@ async def get_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_workspace_request( + _request = build_get_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -213,16 +205,12 @@ async def get_by_workspace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete_by_workspace( # pylint: disable=inconsistent-return-statements @@ -238,12 +226,11 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,22 +244,20 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements 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_by_workspace_request( + _request = build_delete_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,11 +267,7 @@ async def delete_by_workspace( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update_by_workspace( @@ -314,7 +295,6 @@ async def update_by_workspace( :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: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -326,7 +306,7 @@ async def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -342,11 +322,10 @@ async def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +337,7 @@ async def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -372,17 +351,14 @@ async def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection 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 + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +381,7 @@ async def update_by_workspace( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_workspace_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -414,16 +390,14 @@ async def update_by_workspace( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -432,16 +406,12 @@ async def update_by_workspace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_host_pool( @@ -466,7 +436,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -479,7 +448,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResultWithSystemData] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +459,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -498,12 +467,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -515,13 +482,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -531,11 +497,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,10 +513,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections" - } - @distributed_trace_async async def get_by_host_pool( self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -565,12 +527,11 @@ async def get_by_host_pool( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -584,22 +545,20 @@ async def get_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_host_pool_request( + _request = build_get_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,16 +567,12 @@ async def get_by_host_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements @@ -633,12 +588,11 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,22 +606,20 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements 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_by_host_pool_request( + _request = build_delete_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -677,11 +629,7 @@ async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update_by_host_pool( @@ -709,7 +657,6 @@ async def update_by_host_pool( :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: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -721,7 +668,7 @@ async def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -737,11 +684,10 @@ async def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -753,7 +699,7 @@ async def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -767,17 +713,14 @@ async def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection 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 + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +743,7 @@ async def update_by_host_pool( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_host_pool_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -809,16 +752,14 @@ async def update_by_host_pool( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -827,13 +768,9 @@ async def update_by_host_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py index 8ad224b15a8f..f47e7e19d506 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,19 +20,21 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request from ...operations._private_link_resources_operations import ( build_list_by_host_pool_request, build_list_by_workspace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +81,6 @@ def list_by_workspace( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -90,7 +92,7 @@ def list_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,7 +103,7 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -109,12 +111,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -126,13 +126,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -142,11 +141,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,10 +157,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace def list_by_host_pool( self, @@ -185,7 +180,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -197,7 +191,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +202,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -216,12 +210,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -233,13 +225,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -249,11 +240,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,7 +255,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py index 5f2a11824667..621c61afe6ed 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_personal_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._scaling_plan_personal_schedules_operations import ( build_create_request, build_delete_request, @@ -37,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,12 +76,11 @@ async def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,22 +94,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,16 +116,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload async def create( @@ -154,7 +150,6 @@ async def create( :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: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -166,7 +161,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -182,11 +177,10 @@ async def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +192,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Create or update a ScalingPlanPersonalSchedule. @@ -211,18 +205,14 @@ async def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedule type or a IO type. Required. + either a ScalingPlanPersonalSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +235,7 @@ async def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -254,16 +244,14 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -272,21 +260,13 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -300,12 +280,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,22 +298,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,11 +321,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -377,7 +350,6 @@ async def 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: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +361,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -405,11 +377,10 @@ async def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -421,7 +392,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -434,18 +405,14 @@ async def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +438,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -480,16 +447,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,16 +463,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -532,7 +493,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of cls(response) :rtype: @@ -545,7 +505,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +516,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -564,12 +524,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -581,13 +539,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPersonalScheduleList", pipeline_response) @@ -597,11 +554,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,7 +569,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py index 4288a390118d..4f2c8e715a3c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plan_pooled_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._scaling_plan_pooled_schedules_operations import ( build_create_request, build_delete_request, @@ -37,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,12 +76,11 @@ async def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,22 +94,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,16 +116,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload async def create( @@ -153,7 +149,6 @@ async def create( :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: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -165,7 +160,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -181,11 +176,10 @@ async def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -197,7 +191,7 @@ async def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Create or update a ScalingPlanPooledSchedule. @@ -210,18 +204,14 @@ async def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedule type or a IO type. Required. + either a ScalingPlanPooledSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule - 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 + or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +234,7 @@ async def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -253,16 +243,14 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,21 +259,13 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -299,12 +279,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,22 +297,20 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,11 +320,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -376,7 +349,6 @@ async def 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: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +360,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -404,11 +376,10 @@ async def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -420,7 +391,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -433,18 +404,14 @@ async def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +437,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -479,16 +446,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,16 +462,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -531,7 +492,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of cls(response) :rtype: @@ -544,7 +504,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +515,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -563,12 +523,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -580,13 +538,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPooledScheduleList", pipeline_response) @@ -596,11 +553,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,7 +568,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py index 07a18ba75c65..1cdf85e4fd44 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._scaling_plans_operations import ( build_create_request, build_delete_request, @@ -39,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,12 +74,11 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,21 +92,19 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,16 +113,12 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @overload async def create( @@ -146,7 +142,6 @@ async def create( :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: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -157,7 +152,7 @@ async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: IO, + scaling_plan: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -170,11 +165,10 @@ async def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Required. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -185,7 +179,7 @@ async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Union[_models.ScalingPlan, IO], + scaling_plan: Union[_models.ScalingPlan, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlan: """Create or update a scaling plan. @@ -196,17 +190,13 @@ async def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlan type - or a IO type. Required. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan 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 + or a IO[bytes] type. Required. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,7 +219,7 @@ async def create( else: _json = self._serialize.body(scaling_plan, "ScalingPlan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -237,16 +227,14 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,21 +243,13 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any @@ -281,12 +261,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,21 +279,19 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,11 +301,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -352,7 +325,6 @@ async def 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: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +335,7 @@ async def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[IO] = None, + scaling_plan: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -376,11 +348,10 @@ async def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Default value is None. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -391,7 +362,7 @@ async def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO]] = None, + scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlan: """Update a scaling plan. @@ -402,17 +373,13 @@ async def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlanPatch - type or a IO type. Default value is None. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch 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 + type or a IO[bytes] type. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +405,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -446,16 +413,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,16 +429,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -495,7 +456,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -507,7 +467,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -518,19 +478,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -542,13 +500,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -558,11 +515,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,10 +531,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_subscription( self, @@ -594,7 +547,6 @@ def list_by_subscription( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -606,7 +558,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,18 +569,16 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -640,13 +590,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -656,11 +605,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,10 +621,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_host_pool( self, @@ -699,7 +644,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] @@ -711,7 +655,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +666,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -730,12 +674,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -747,13 +689,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -763,11 +704,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -778,7 +719,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..a56176d53240 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py @@ -0,0 +1,647 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._session_host_configurations_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` 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, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO[bytes] type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + 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[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO[bytes] type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + 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[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..df540f9b35c1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py @@ -0,0 +1,471 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, 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.rest import AsyncHttpResponse, 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 ...operations._session_host_managements_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` 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, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO[bytes]], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO[bytes] type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO[bytes] type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :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.SessionHostManagementList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..a2782f0294bc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py @@ -0,0 +1,112 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._session_host_managements_update_status_operations import build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsUpdateStatusOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_update_status` 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, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostManagementUpdateStatus: + """Get the session host update status for a given hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagementUpdateStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementUpdateStatus] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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("SessionHostManagementUpdateStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py new file mode 100644 index 000000000000..8d16da088de0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py @@ -0,0 +1,111 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._session_host_operations import build_retry_provisioning_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` 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 retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py index fb715071fc1d..4885c96f5c53 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._session_hosts_operations import ( build_delete_request, build_get_request, @@ -36,6 +35,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,12 +76,11 @@ async def get( :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,22 +94,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,16 +116,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SessionHost", pipeline_response) + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -149,12 +145,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :param force: Force flag to force sessionHost deletion even when userSession exists. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,23 +163,21 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,11 +187,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -230,7 +219,6 @@ async def 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: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -243,7 +231,7 @@ async def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[IO] = None, + session_host: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -262,11 +250,10 @@ async def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Default value is None. - :type session_host: IO + :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -279,7 +266,7 @@ async def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[Union[_models.SessionHostPatch, IO]] = None, + session_host: Optional[Union[_models.SessionHostPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.SessionHost: """Update a session host. @@ -296,17 +283,13 @@ async def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO type. Default value is None. - :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch 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 + type or a IO[bytes] type. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO[bytes] :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +315,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -342,16 +325,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,16 +341,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SessionHost", pipeline_response) + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -379,6 +356,7 @@ def list( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SessionHost"]: """List sessionHosts. @@ -394,7 +372,8 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response + :param vm_path: The path to the VM. Default value is None. + :type vm_path: str :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] @@ -406,7 +385,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHostList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,20 +396,19 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, + vm_path=vm_path, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -442,13 +420,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SessionHostList", pipeline_response) @@ -458,11 +435,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,7 +450,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py index 588bd942aee8..ac7671a50014 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request from ...operations._start_menu_items_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItem or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItem] @@ -87,7 +89,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StartMenuItemList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +100,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -106,12 +108,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +123,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StartMenuItemList", pipeline_response) @@ -139,11 +138,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,7 +153,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py index 5be197d547e6..05aeae0749fe 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._user_sessions_operations import ( build_delete_request, build_disconnect_request, @@ -38,6 +37,10 @@ build_send_message_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +91,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] @@ -100,7 +102,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSessionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +113,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -120,12 +122,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -137,13 +137,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -153,11 +152,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,10 +168,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions" - } - @distributed_trace_async async def get( self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -190,12 +185,11 @@ async def get( :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,23 +203,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSession] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,16 +226,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UserSession", pipeline_response) + deserialized = self._deserialize("UserSession", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -270,12 +258,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param force: Force flag to login off userSession. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +276,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -297,16 +284,14 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,11 +301,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -349,7 +330,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] @@ -361,7 +341,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSessionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +352,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -381,12 +361,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -398,13 +376,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -414,11 +391,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,10 +407,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions" - } - @distributed_trace_async async def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -451,12 +424,11 @@ async def disconnect( # pylint: disable=inconsistent-return-statements :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,23 +442,21 @@ async def disconnect( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_disconnect_request( + _request = build_disconnect_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.disconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -496,11 +466,7 @@ async def disconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - disconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def send_message( # pylint: disable=inconsistent-return-statements @@ -533,7 +499,6 @@ async def send_message( # pylint: disable=inconsistent-return-statements :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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -546,7 +511,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[IO] = None, + send_message: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -566,11 +531,10 @@ async def send_message( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param send_message: Object containing message includes title and message body. Default value is None. - :type send_message: IO + :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword 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: @@ -583,7 +547,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[Union[_models.SendMessage, IO]] = None, + send_message: Optional[Union[_models.SendMessage, IO[bytes]]] = None, **kwargs: Any ) -> None: """Send a message to a user. @@ -600,17 +564,13 @@ async def send_message( # pylint: disable=inconsistent-return-statements Required. :type user_session_id: str :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO type. Default value is None. - :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage 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 + SendMessage type or a IO[bytes] type. Default value is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +596,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_send_message_request( + _request = build_send_message_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -646,16 +606,14 @@ async def send_message( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.send_message.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,8 +623,4 @@ async def send_message( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send_message.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py index 5c93e9d08b3d..c75eaf26869a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._workspaces_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,12 +73,11 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,21 +91,19 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -112,16 +112,12 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -145,7 +141,6 @@ async def create_or_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: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -156,7 +151,7 @@ async def create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -169,11 +164,10 @@ async def create_or_update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Required. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -181,7 +175,11 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: """Create or update a workspace. @@ -190,18 +188,14 @@ async def create_or_update( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param workspace: Object containing Workspace definitions. Is either a Workspace type or a IO - type. Required. - :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace 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 + :param workspace: Object containing Workspace definitions. Is either a Workspace type or a + IO[bytes] type. Required. + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +218,7 @@ async def create_or_update( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -232,16 +226,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,21 +242,13 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -276,12 +260,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,21 +278,19 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,11 +300,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -347,7 +324,6 @@ async def 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: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +334,7 @@ async def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[IO] = None, + workspace: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -371,11 +347,10 @@ async def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Default value is None. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -386,7 +361,7 @@ async def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[Union[_models.WorkspacePatch, IO]] = None, + workspace: Optional[Union[_models.WorkspacePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Workspace: """Update a workspace. @@ -397,17 +372,13 @@ async def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Is either a WorkspacePatch type or a - IO type. Default value is None. - :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch 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 + IO[bytes] type. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +404,7 @@ async def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -441,16 +412,14 @@ async def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,16 +428,12 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -490,7 +455,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] @@ -502,7 +466,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,19 +477,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -537,13 +499,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -553,11 +514,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,15 +530,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: """List workspaces in subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] @@ -589,7 +545,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspac api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,15 +556,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspac def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -620,13 +574,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -636,11 +589,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +604,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py index 7609aaaadd1d..0664dc2df252 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py @@ -6,24 +6,54 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ActiveDirectoryInfoPatchProperties +from ._models_py3 import ActiveDirectoryInfoProperties +from ._models_py3 import ActiveSessionHostConfiguration +from ._models_py3 import ActiveSessionHostConfigurationList from ._models_py3 import AgentUpdatePatchProperties from ._models_py3 import AgentUpdateProperties +from ._models_py3 import AppAttachPackage +from ._models_py3 import AppAttachPackageInfoProperties +from ._models_py3 import AppAttachPackageList +from ._models_py3 import AppAttachPackagePatch +from ._models_py3 import AppAttachPackagePatchProperties +from ._models_py3 import AppAttachPackageProperties from ._models_py3 import Application from ._models_py3 import ApplicationGroup from ._models_py3 import ApplicationGroupList from ._models_py3 import ApplicationGroupPatch from ._models_py3 import ApplicationList from ._models_py3 import ApplicationPatch +from ._models_py3 import AzureActiveDirectoryInfoProperties +from ._models_py3 import BootDiagnosticsInfoPatchProperties +from ._models_py3 import BootDiagnosticsInfoProperties from ._models_py3 import CloudErrorProperties +from ._models_py3 import CustomInfoPatchProperties +from ._models_py3 import CustomInfoProperties from ._models_py3 import Desktop from ._models_py3 import DesktopList from ._models_py3 import DesktopPatch +from ._models_py3 import DiskInfoPatchProperties +from ._models_py3 import DiskInfoProperties +from ._models_py3 import DomainInfoPatchProperties +from ._models_py3 import DomainInfoProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import ExpandMsixImage from ._models_py3 import ExpandMsixImageList from ._models_py3 import HostPool from ._models_py3 import HostPoolList from ._models_py3 import HostPoolPatch -from ._models_py3 import Identity +from ._models_py3 import HostPoolUpdateConfigurationPatchProperties +from ._models_py3 import HostPoolUpdateConfigurationProperties +from ._models_py3 import HostPoolUpdateControlParameter +from ._models_py3 import HostPoolUpdateFault +from ._models_py3 import ImageInfoPatchProperties +from ._models_py3 import ImageInfoProperties +from ._models_py3 import ImportPackageInfoRequest +from ._models_py3 import KeyVaultCredentialsPatchProperties +from ._models_py3 import KeyVaultCredentialsProperties from ._models_py3 import LogSpecification from ._models_py3 import MSIXImageURI from ._models_py3 import MSIXPackage @@ -31,8 +61,13 @@ from ._models_py3 import MSIXPackagePatch from ._models_py3 import MaintenanceWindowPatchProperties from ._models_py3 import MaintenanceWindowProperties +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MarketplaceInfoPatchProperties +from ._models_py3 import MarketplaceInfoProperties from ._models_py3 import MsixPackageApplications from ._models_py3 import MsixPackageDependencies +from ._models_py3 import NetworkInfoPatchProperties +from ._models_py3 import NetworkInfoProperties from ._models_py3 import OperationProperties from ._models_py3 import Plan from ._models_py3 import PrivateEndpoint @@ -45,11 +80,10 @@ from ._models_py3 import ProxyResource from ._models_py3 import RegistrationInfo from ._models_py3 import RegistrationInfoPatch +from ._models_py3 import RegistrationTokenList +from ._models_py3 import RegistrationTokenMinimal from ._models_py3 import Resource from ._models_py3 import ResourceModelWithAllowedPropertySet -from ._models_py3 import ResourceModelWithAllowedPropertySetIdentity -from ._models_py3 import ResourceModelWithAllowedPropertySetPlan -from ._models_py3 import ResourceModelWithAllowedPropertySetSku from ._models_py3 import ResourceProviderOperation from ._models_py3 import ResourceProviderOperationDisplay from ._models_py3 import ResourceProviderOperationList @@ -64,44 +98,71 @@ from ._models_py3 import ScalingPlanPooledScheduleList from ._models_py3 import ScalingPlanPooledSchedulePatch from ._models_py3 import ScalingSchedule +from ._models_py3 import SecurityInfoPatchProperties +from ._models_py3 import SecurityInfoProperties from ._models_py3 import SendMessage from ._models_py3 import ServiceSpecification from ._models_py3 import SessionHost +from ._models_py3 import SessionHostConfiguration +from ._models_py3 import SessionHostConfigurationList +from ._models_py3 import SessionHostConfigurationPatch from ._models_py3 import SessionHostHealthCheckFailureDetails from ._models_py3 import SessionHostHealthCheckReport from ._models_py3 import SessionHostList +from ._models_py3 import SessionHostManagement +from ._models_py3 import SessionHostManagementList +from ._models_py3 import SessionHostManagementOperationProgress +from ._models_py3 import SessionHostManagementPatch +from ._models_py3 import SessionHostManagementUpdateStatus from ._models_py3 import SessionHostPatch from ._models_py3 import Sku from ._models_py3 import StartMenuItem from ._models_py3 import StartMenuItemList from ._models_py3 import SystemData from ._models_py3 import Time +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateSessionHostsRequestBody +from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserSession from ._models_py3 import UserSessionList from ._models_py3 import Workspace from ._models_py3 import WorkspaceList from ._models_py3 import WorkspacePatch +from ._desktop_virtualization_mgmt_client_enums import AppAttachPackageArchitectures from ._desktop_virtualization_mgmt_client_enums import ApplicationGroupType from ._desktop_virtualization_mgmt_client_enums import ApplicationType from ._desktop_virtualization_mgmt_client_enums import CommandLineSetting from ._desktop_virtualization_mgmt_client_enums import CreatedByType from ._desktop_virtualization_mgmt_client_enums import DayOfWeek +from ._desktop_virtualization_mgmt_client_enums import DirectUDP +from ._desktop_virtualization_mgmt_client_enums import DomainJoinType +from ._desktop_virtualization_mgmt_client_enums import FailHealthCheckOnStagingFailure +from ._desktop_virtualization_mgmt_client_enums import FaultType from ._desktop_virtualization_mgmt_client_enums import HealthCheckName from ._desktop_virtualization_mgmt_client_enums import HealthCheckResult from ._desktop_virtualization_mgmt_client_enums import HostPoolType +from ._desktop_virtualization_mgmt_client_enums import HostPoolUpdateAction from ._desktop_virtualization_mgmt_client_enums import HostpoolPublicNetworkAccess from ._desktop_virtualization_mgmt_client_enums import LoadBalancerType +from ._desktop_virtualization_mgmt_client_enums import ManagedPrivateUDP +from ._desktop_virtualization_mgmt_client_enums import ManagedServiceIdentityType +from ._desktop_virtualization_mgmt_client_enums import ManagementType +from ._desktop_virtualization_mgmt_client_enums import OperationTypeSHM +from ._desktop_virtualization_mgmt_client_enums import PackageTimestamped from ._desktop_virtualization_mgmt_client_enums import PersonalDesktopAssignmentType from ._desktop_virtualization_mgmt_client_enums import PreferredAppGroupType from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointConnectionProvisioningState from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointServiceConnectionStatus +from ._desktop_virtualization_mgmt_client_enums import ProvisioningState +from ._desktop_virtualization_mgmt_client_enums import ProvisioningStateSHC from ._desktop_virtualization_mgmt_client_enums import PublicNetworkAccess +from ._desktop_virtualization_mgmt_client_enums import PublicUDP from ._desktop_virtualization_mgmt_client_enums import RegistrationTokenOperation +from ._desktop_virtualization_mgmt_client_enums import RelayUDP from ._desktop_virtualization_mgmt_client_enums import RemoteApplicationType from ._desktop_virtualization_mgmt_client_enums import SSOSecretType from ._desktop_virtualization_mgmt_client_enums import ScalingHostPoolType -from ._desktop_virtualization_mgmt_client_enums import ScalingScheduleDaysOfWeekItem from ._desktop_virtualization_mgmt_client_enums import SessionHandlingOperation from ._desktop_virtualization_mgmt_client_enums import SessionHostComponentUpdateType from ._desktop_virtualization_mgmt_client_enums import SessionHostLoadBalancingAlgorithm @@ -111,30 +172,63 @@ from ._desktop_virtualization_mgmt_client_enums import StartupBehavior from ._desktop_virtualization_mgmt_client_enums import Status from ._desktop_virtualization_mgmt_client_enums import StopHostsWhen +from ._desktop_virtualization_mgmt_client_enums import Type from ._desktop_virtualization_mgmt_client_enums import UpdateState +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineDiskType +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineSecurityType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActiveDirectoryInfoPatchProperties", + "ActiveDirectoryInfoProperties", + "ActiveSessionHostConfiguration", + "ActiveSessionHostConfigurationList", "AgentUpdatePatchProperties", "AgentUpdateProperties", + "AppAttachPackage", + "AppAttachPackageInfoProperties", + "AppAttachPackageList", + "AppAttachPackagePatch", + "AppAttachPackagePatchProperties", + "AppAttachPackageProperties", "Application", "ApplicationGroup", "ApplicationGroupList", "ApplicationGroupPatch", "ApplicationList", "ApplicationPatch", + "AzureActiveDirectoryInfoProperties", + "BootDiagnosticsInfoPatchProperties", + "BootDiagnosticsInfoProperties", "CloudErrorProperties", + "CustomInfoPatchProperties", + "CustomInfoProperties", "Desktop", "DesktopList", "DesktopPatch", + "DiskInfoPatchProperties", + "DiskInfoProperties", + "DomainInfoPatchProperties", + "DomainInfoProperties", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "ExpandMsixImage", "ExpandMsixImageList", "HostPool", "HostPoolList", "HostPoolPatch", - "Identity", + "HostPoolUpdateConfigurationPatchProperties", + "HostPoolUpdateConfigurationProperties", + "HostPoolUpdateControlParameter", + "HostPoolUpdateFault", + "ImageInfoPatchProperties", + "ImageInfoProperties", + "ImportPackageInfoRequest", + "KeyVaultCredentialsPatchProperties", + "KeyVaultCredentialsProperties", "LogSpecification", "MSIXImageURI", "MSIXPackage", @@ -142,8 +236,13 @@ "MSIXPackagePatch", "MaintenanceWindowPatchProperties", "MaintenanceWindowProperties", + "ManagedServiceIdentity", + "MarketplaceInfoPatchProperties", + "MarketplaceInfoProperties", "MsixPackageApplications", "MsixPackageDependencies", + "NetworkInfoPatchProperties", + "NetworkInfoProperties", "OperationProperties", "Plan", "PrivateEndpoint", @@ -156,11 +255,10 @@ "ProxyResource", "RegistrationInfo", "RegistrationInfoPatch", + "RegistrationTokenList", + "RegistrationTokenMinimal", "Resource", "ResourceModelWithAllowedPropertySet", - "ResourceModelWithAllowedPropertySetIdentity", - "ResourceModelWithAllowedPropertySetPlan", - "ResourceModelWithAllowedPropertySetSku", "ResourceProviderOperation", "ResourceProviderOperationDisplay", "ResourceProviderOperationList", @@ -175,43 +273,70 @@ "ScalingPlanPooledScheduleList", "ScalingPlanPooledSchedulePatch", "ScalingSchedule", + "SecurityInfoPatchProperties", + "SecurityInfoProperties", "SendMessage", "ServiceSpecification", "SessionHost", + "SessionHostConfiguration", + "SessionHostConfigurationList", + "SessionHostConfigurationPatch", "SessionHostHealthCheckFailureDetails", "SessionHostHealthCheckReport", "SessionHostList", + "SessionHostManagement", + "SessionHostManagementList", + "SessionHostManagementOperationProgress", + "SessionHostManagementPatch", + "SessionHostManagementUpdateStatus", "SessionHostPatch", "Sku", "StartMenuItem", "StartMenuItemList", "SystemData", "Time", + "TrackedResource", + "UpdateSessionHostsRequestBody", + "UserAssignedIdentity", "UserSession", "UserSessionList", "Workspace", "WorkspaceList", "WorkspacePatch", + "AppAttachPackageArchitectures", "ApplicationGroupType", "ApplicationType", "CommandLineSetting", "CreatedByType", "DayOfWeek", + "DirectUDP", + "DomainJoinType", + "FailHealthCheckOnStagingFailure", + "FaultType", "HealthCheckName", "HealthCheckResult", "HostPoolType", + "HostPoolUpdateAction", "HostpoolPublicNetworkAccess", "LoadBalancerType", + "ManagedPrivateUDP", + "ManagedServiceIdentityType", + "ManagementType", + "OperationTypeSHM", + "PackageTimestamped", "PersonalDesktopAssignmentType", "PreferredAppGroupType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", + "ProvisioningStateSHC", "PublicNetworkAccess", + "PublicUDP", "RegistrationTokenOperation", + "RelayUDP", "RemoteApplicationType", "SSOSecretType", "ScalingHostPoolType", - "ScalingScheduleDaysOfWeekItem", "SessionHandlingOperation", "SessionHostComponentUpdateType", "SessionHostLoadBalancingAlgorithm", @@ -221,7 +346,10 @@ "StartupBehavior", "Status", "StopHostsWhen", + "Type", "UpdateState", + "VirtualMachineDiskType", + "VirtualMachineSecurityType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py index 378b4904fcfd..627a7c622acc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py @@ -10,6 +10,18 @@ from azure.core import CaseInsensitiveEnumMeta +class AppAttachPackageArchitectures(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible device architectures that an app attach package can be configured for.""" + + ARM = "ARM" + ARM64 = "ARM64" + X86 = "x86" + X64 = "x64" + NEUTRAL = "Neutral" + X86_A64 = "x86a64" + ALL = "ALL" + + class ApplicationGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of ApplicationGroup.""" @@ -56,61 +68,99 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUNDAY = "Sunday" +class DirectUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class DomainJoinType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of domain join done by the virtual machine.""" + + ACTIVE_DIRECTORY = "ActiveDirectory" + """Using microsoft active directory.""" + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + """Using microsoft azure active directory.""" + + +class FailHealthCheckOnStagingFailure(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Parameter indicating how the health check should behave if this package fails staging.""" + + UNHEALTHY = "Unhealthy" + NEEDS_ASSISTANCE = "NeedsAssistance" + DO_NOT_FAIL = "DoNotFail" + + +class FaultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hostpool update fault type.""" + + SERVICE_ERROR = "ServiceError" + """Fault caused by service error.""" + USER_ERROR = "UserError" + """Fault caused by user error.""" + + class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the name of the health check operation performed.""" DOMAIN_JOINED_CHECK = "DomainJoinedCheck" """Verifies the SessionHost is joined to a domain. If this check fails is classified as fatal as - #: no connection can succeed if the SessionHost is not joined to the domain. (Currently Enabled)""" + no connection can succeed if the SessionHost is not joined to the domain. (Currently Enabled)""" DOMAIN_TRUST_CHECK = "DomainTrustCheck" """Verifies the SessionHost is not experiencing domain trust issues that will prevent - #: authentication on SessionHost at connection time when session is created. If this check fails - #: is classified as fatal as no connection can succeed if we cannot reach the domain for - #: authentication on the SessionHost. (Currently Enabled)""" + authentication on SessionHost at connection time when session is created. If this check fails + is classified as fatal as no connection can succeed if we cannot reach the domain for + authentication on the SessionHost. (Currently Enabled)""" FS_LOGIX_HEALTH_CHECK = "FSLogixHealthCheck" """Verifies the FSLogix service is up and running to make sure users' profiles are loaded in the - #: session. If this check fails is classified as fatal as even if the connection can succeed, user - #: experience is bad as the user profile cannot be loaded and user will get a temporary profile in - #: the session. (Currently Disabled)""" + session. If this check fails is classified as fatal as even if the connection can succeed, user + experience is bad as the user profile cannot be loaded and user will get a temporary profile in + the session. (Currently Disabled)""" SX_S_STACK_LISTENER_CHECK = "SxSStackListenerCheck" """Verifies that the SxS stack is up and running so connections can succeed. If this check fails - #: is classified as fatal as no connection can succeed if the SxS stack is not ready. (Currently - #: Enabled)""" + is classified as fatal as no connection can succeed if the SxS stack is not ready. (Currently + Enabled)""" URLS_ACCESSIBLE_CHECK = "UrlsAccessibleCheck" """Verifies that the required WVD service and Geneva URLs are reachable from the SessionHost. - #: These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent - #: monitoring (geneva). If this check fails, it is non fatal and the machine still can service - #: connections, main issue may be that monitoring agent is unable to store warm path data (logs, - #: operations ...). (Currently Disabled)""" + These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent + monitoring (geneva). If this check fails, it is non fatal and the machine still can service + connections, main issue may be that monitoring agent is unable to store warm path data (logs, + operations ...). (Currently Disabled)""" MONITORING_AGENT_CHECK = "MonitoringAgentCheck" """Verifies that the required Geneva agent is running. If this check fails, it is non fatal and - #: the machine still can service connections, main issue may be that monitoring agent is missing - #: or running (possibly) older version. (Currently Enabled)""" + the machine still can service connections, main issue may be that monitoring agent is missing + or running (possibly) older version. (Currently Enabled)""" DOMAIN_REACHABLE = "DomainReachable" """Verifies the domain the SessionHost is joined to is still reachable. If this check fails is - #: classified as fatal as no connection can succeed if the domain the SessionHost is joined is not - #: reachable at the time of connection. (Currently Disabled)""" + classified as fatal as no connection can succeed if the domain the SessionHost is joined is not + reachable at the time of connection. (Currently Disabled)""" WEB_RTC_REDIRECTOR_CHECK = "WebRTCRedirectorCheck" """Verifies whether the WebRTCRedirector component is healthy. The WebRTCRedirector component is - #: used to optimize video and audio performance in Microsoft Teams. This checks whether the - #: component is still running, and whether there is a higher version available. If this check - #: fails, it is non fatal and the machine still can service connections, main issue may be the - #: WebRTCRedirector component has to be restarted or updated. (Currently Disabled)""" + used to optimize video and audio performance in Microsoft Teams. This checks whether the + component is still running, and whether there is a higher version available. If this check + fails, it is non fatal and the machine still can service connections, main issue may be the + WebRTCRedirector component has to be restarted or updated. (Currently Disabled)""" SUPPORTED_ENCRYPTION_CHECK = "SupportedEncryptionCheck" """Verifies the value of SecurityLayer registration key. If the value is 0 (SecurityLayer.RDP) - #: this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 - #: (SecurityLayer.Negotiate) this check fails with Error code = - #: NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. (Currently Disabled)""" + this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 + (SecurityLayer.Negotiate) this check fails with Error code = + NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. (Currently Disabled)""" META_DATA_SERVICE_CHECK = "MetaDataServiceCheck" """Verifies the metadata service is accessible and return compute properties. (Currently Enabled)""" APP_ATTACH_HEALTH_CHECK = "AppAttachHealthCheck" """Verifies that the AppAttachService is healthy (there were no issues during package staging). - #: The AppAttachService is used to enable the staging/registration (and eventual - #: deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks - #: whether the component had any failures during package staging. Failures in staging will prevent - #: some MSIX apps from working properly for the end user. If this check fails, it is non fatal and - #: the machine still can service connections, main issue may be certain apps will not work for - #: end-users. (Currently Enabled)""" + The AppAttachService is used to enable the staging/registration (and eventual + deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks + whether the component had any failures during package staging. Failures in staging will prevent + some MSIX apps from working properly for the end user. If this check fails, it is non fatal and + the machine still can service connections, main issue may be certain apps will not work for + end-users. (Currently Enabled)""" class HealthCheckResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -142,13 +192,28 @@ class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSONAL = "Personal" """Users will be assigned a SessionHost either by administrators (PersonalDesktopAssignmentType = - #: Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will - #: always be redirected to their assigned SessionHost.""" + Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will + always be redirected to their assigned SessionHost.""" POOLED = "Pooled" """Users get a new (random) SessionHost every time it connects to the HostPool.""" BYO_DESKTOP = "BYODesktop" """Users assign their own machines, load balancing logic remains the same as Personal. - #: PersonalDesktopAssignmentType must be Direct.""" + PersonalDesktopAssignmentType must be Direct.""" + + +class HostPoolUpdateAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action types for controlling hostpool update.""" + + START = "Start" + """Start the hostpool update.""" + PAUSE = "Pause" + """Pause the hostpool update.""" + CANCEL = "Cancel" + """Cancel the hostpool update.""" + RETRY = "Retry" + """Retry the hostpool update.""" + RESUME = "Resume" + """Resume the hostpool update.""" class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -157,6 +222,53 @@ class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): BREADTH_FIRST = "BreadthFirst" DEPTH_FIRST = "DepthFirst" PERSISTENT = "Persistent" + MULTIPLE_PERSISTENT = "MultiplePersistent" + + +class ManagedPrivateUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class ManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of management for this hostpool, Automated or Standard. The default value is + Automated. + """ + + AUTOMATED = "Automated" + STANDARD = "Standard" + + +class OperationTypeSHM(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OperationTypeSHM.""" + + INITIATE_SESSION_HOST_UPDATE = "InitiateSessionHostUpdate" + VALIDATE_SESSION_HOST_UPDATE = "ValidateSessionHostUpdate" + + +class PackageTimestamped(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Is package timestamped so it can ignore the certificate expiry date.""" + + TIMESTAMPED = "Timestamped" + NOT_TIMESTAMPED = "NotTimestamped" class PersonalDesktopAssignmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -170,8 +282,13 @@ class PreferredAppGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of preferred application group type, default to Desktop Application Group.""" NONE = "None" + """This value is read only, it is not accepted on input.""" DESKTOP = "Desktop" + """Users access the full Windows desktop from a session host. Available with pooled or personal + host pools.""" RAIL_APPLICATIONS = "RailApplications" + """Users access individual applications you select and publish to the application group. Available + with pooled host pools only.""" class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -191,6 +308,24 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv REJECTED = "Rejected" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + PROVISIONING = "Provisioning" + FAILED = "Failed" + CANCELED = "Canceled" + + +class ProvisioningStateSHC(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Session Host Configuration.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. @@ -200,6 +335,18 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class PublicUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of resetting the token.""" @@ -208,6 +355,18 @@ class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATE = "Update" +class RelayUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RemoteApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of Application.""" @@ -220,18 +379,10 @@ class ScalingHostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): POOLED = "Pooled" """Users get a new (random) SessionHost every time it connects to the HostPool.""" - - -class ScalingScheduleDaysOfWeekItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScalingScheduleDaysOfWeekItem.""" - - SUNDAY = "Sunday" - MONDAY = "Monday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - THURSDAY = "Thursday" - FRIDAY = "Friday" - SATURDAY = "Saturday" + PERSONAL = "Personal" + """Users will be assigned a SessionHost either by administrators (PersonalDesktopAssignmentType = + Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will + always be redirected to their assigned SessionHost.""" class SessionHandlingOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -304,7 +455,7 @@ class StartupBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" """Session hosts will not be started by the service. This setting depends on Start VM on Connect - #: to be enabled to start the session hosts.""" + to be enabled to start the session hosts.""" WITH_ASSIGNED_USER = "WithAssignedUser" """Session hosts with an assigned user will be started during Ramp Up""" ALL = "All" @@ -318,19 +469,19 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Session Host has passed all the health checks and is available to handle connections.""" UNAVAILABLE = "Unavailable" """Session Host is either turned off or has failed critical health checks which is causing service - #: not to be able to route connections to this session host. Note this replaces previous - #: 'NoHeartBeat' status.""" + not to be able to route connections to this session host. Note this replaces previous + 'NoHeartBeat' status.""" SHUTDOWN = "Shutdown" """Session Host is shutdown - RD Agent reported session host to be stopped or deallocated.""" DISCONNECTED = "Disconnected" """The Session Host is unavailable because it is currently disconnected.""" UPGRADING = "Upgrading" """Session Host is unavailable because currently an upgrade of RDAgent/side-by-side stack is in - #: progress. Note: this state will be removed once the upgrade completes and the host is able to - #: accept connections.""" + progress. Note: this state will be removed once the upgrade completes and the host is able to + accept connections.""" UPGRADE_FAILED = "UpgradeFailed" """Session Host is unavailable because the critical component upgrade (agent, side-by-side stack, - #: etc.) failed.""" + etc.) failed.""" NO_HEARTBEAT = "NoHeartbeat" """The Session Host is not heart beating.""" NOT_JOINED_TO_DOMAIN = "NotJoinedToDomain" @@ -343,7 +494,7 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FSLogix is in an unhealthy state on the session host.""" NEEDS_ASSISTANCE = "NeedsAssistance" """New status to inform admins that the health on their endpoint needs to be fixed. The - #: connections might not fail, as these issues are not fatal.""" + connections might not fail, as these issues are not fatal.""" class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -353,6 +504,15 @@ class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of image session hosts use in the hostpool.""" + + MARKETPLACE = "Marketplace" + """Using default marketplace images offered by Azure Marketplace.""" + CUSTOM = "Custom" + """Using a custom image.""" + + class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Update state of a SessionHost.""" @@ -361,3 +521,26 @@ class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): STARTED = "Started" SUCCEEDED = "Succeeded" FAILED = "Failed" + + +class VirtualMachineDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The disk type used by virtual machine in hostpool session host.""" + + STANDARD_LRS = "Standard_LRS" + """Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access.""" + PREMIUM_LRS = "Premium_LRS" + """Premium SSD locally redundant storage. Best for production and performance sensitive workloads.""" + STANDARD_SSD_LRS = "StandardSSD_LRS" + """Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + applications and dev/test.""" + + +class VirtualMachineSecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The security type used by virtual machine in hostpool session host. Default is Standard.""" + + STANDARD = "Standard" + """Standard security protocol. No additional parameters""" + TRUSTED_LAUNCH = "TrustedLaunch" + """TrustedLaunch allows for secure boot adn vTPM""" + CONFIDENTIAL_VM = "ConfidentialVM" + """Confidential Virtual Machine security protocol""" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py index f410efbcb55b..46fdd05372cb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py @@ -8,21 +8,338 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -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 .. import models as _models +class ActiveDirectoryInfoPatchProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + :ivar domain_credentials: Credentials needed to create the virtual machine. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + } + + def __init__( + self, *, domain_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + + +class ActiveDirectoryInfoProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to server. + + :ivar domain_credentials: Credentials needed to create the virtual machine. Required. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar ou_path: The organizational unit(OU) path. Required. + :vartype ou_path: str + :ivar domain_name: The domain a virtual machine connected to a hostpool will join. + :vartype domain_name: str + """ + + _validation = { + "domain_credentials": {"required": True}, + "ou_path": {"required": True}, + } + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsProperties"}, + "ou_path": {"key": "ouPath", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + } + + def __init__( + self, + *, + domain_credentials: "_models.KeyVaultCredentialsProperties", + ou_path: str, + domain_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. Required. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword ou_path: The organizational unit(OU) path. Required. + :paramtype ou_path: str + :keyword domain_name: The domain a virtual machine connected to a hostpool will join. + :paramtype domain_name: str + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + self.ou_path = ou_path + self.domain_name = domain_name + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ActiveSessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a ActiveSessionHostConfiguration definition. This has all of the + sessionHostConfiguration properties except provisioningState. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.version = None + self.friendly_name = friendly_name + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class ActiveSessionHostConfigurationList(_serialization.Model): + """List of ActiveSessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ActiveSessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ActiveSessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ActiveSessionHostConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of ActiveSessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + class AgentUpdatePatchProperties(_serialization.Model): """The session host configuration for updating agent, monitoring agent, and stack component. @@ -133,39 +450,513 @@ def __init__( self.maintenance_windows = maintenance_windows -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": 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"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AppAttachPackage(TrackedResource): + """Schema for App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Detailed properties for App Attach Package. Required. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": 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"}, + "properties": {"key": "properties", "type": "AppAttachPackageProperties"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.AppAttachPackageProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Detailed properties for App Attach Package. Required. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Schema for Import Package Information properties. + + :ivar package_alias: Alias of App Attach Package. Assigned at import time. + :vartype package_alias: str + :ivar image_path: VHD/CIM/APP-V image path on Network Share. + :vartype image_path: str + :ivar package_name: Package Name from appxmanifest.xml. + :vartype package_name: str + :ivar package_family_name: Identifier not including the package version, for Msix packages it + is the family name from the appxmanifest.xml. + :vartype package_family_name: str + :ivar package_full_name: Identifier including the package version, for Msix packages it is the + full name from the appxmanifest.xml. + :vartype package_full_name: str + :ivar display_name: User friendly Name to be displayed in the portal. + :vartype display_name: str + :ivar package_relative_path: Relative Path to the package inside the image. + :vartype package_relative_path: str + :ivar is_regular_registration: Specifies how to register Package in feed. + :vartype is_regular_registration: bool + :ivar is_active: Make this version of the package the active one across the hostpool. + :vartype is_active: bool + :ivar package_dependencies: List of package dependencies. + :vartype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :ivar version: Package Version found in the appxmanifest.xml. + :vartype version: str + :ivar last_updated: Date the package source was last updated, for Msix packages this is found + in the appxmanifest.xml. + :vartype last_updated: ~datetime.datetime + :ivar package_applications: List of package applications. + :vartype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime + :ivar is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :vartype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + + _attribute_map = { + "package_alias": {"key": "packageAlias", "type": "str"}, + "image_path": {"key": "imagePath", "type": "str"}, + "package_name": {"key": "packageName", "type": "str"}, + "package_family_name": {"key": "packageFamilyName", "type": "str"}, + "package_full_name": {"key": "packageFullName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "package_relative_path": {"key": "packageRelativePath", "type": "str"}, + "is_regular_registration": {"key": "isRegularRegistration", "type": "bool"}, + "is_active": {"key": "isActive", "type": "bool"}, + "package_dependencies": {"key": "packageDependencies", "type": "[MsixPackageDependencies]"}, + "version": {"key": "version", "type": "str"}, + "last_updated": {"key": "lastUpdated", "type": "iso-8601"}, + "package_applications": {"key": "packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "certificateName", "type": "str"}, + "certificate_expiry": {"key": "certificateExpiry", "type": "iso-8601"}, + "is_package_timestamped": {"key": "isPackageTimestamped", "type": "str"}, + } + + def __init__( + self, + *, + package_alias: Optional[str] = None, + image_path: Optional[str] = None, + package_name: Optional[str] = None, + package_family_name: Optional[str] = None, + package_full_name: Optional[str] = None, + display_name: Optional[str] = None, + package_relative_path: Optional[str] = None, + is_regular_registration: Optional[bool] = None, + is_active: Optional[bool] = None, + package_dependencies: Optional[List["_models.MsixPackageDependencies"]] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, + is_package_timestamped: Optional[Union[str, "_models.PackageTimestamped"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword package_alias: Alias of App Attach Package. Assigned at import time. + :paramtype package_alias: str + :keyword image_path: VHD/CIM/APP-V image path on Network Share. + :paramtype image_path: str + :keyword package_name: Package Name from appxmanifest.xml. + :paramtype package_name: str + :keyword package_family_name: Identifier not including the package version, for Msix packages + it is the family name from the appxmanifest.xml. + :paramtype package_family_name: str + :keyword package_full_name: Identifier including the package version, for Msix packages it is + the full name from the appxmanifest.xml. + :paramtype package_full_name: str + :keyword display_name: User friendly Name to be displayed in the portal. + :paramtype display_name: str + :keyword package_relative_path: Relative Path to the package inside the image. + :paramtype package_relative_path: str + :keyword is_regular_registration: Specifies how to register Package in feed. + :paramtype is_regular_registration: bool + :keyword is_active: Make this version of the package the active one across the hostpool. + :paramtype is_active: bool + :keyword package_dependencies: List of package dependencies. + :paramtype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :keyword version: Package Version found in the appxmanifest.xml. + :paramtype version: str + :keyword last_updated: Date the package source was last updated, for Msix packages this is + found in the appxmanifest.xml. + :paramtype last_updated: ~datetime.datetime + :keyword package_applications: List of package applications. + :paramtype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime + :keyword is_package_timestamped: Is package timestamped so it can ignore the certificate expiry + date. Known values are: "Timestamped" and "NotTimestamped". + :paramtype is_package_timestamped: str or + ~azure.mgmt.desktopvirtualization.models.PackageTimestamped + """ + super().__init__(**kwargs) + self.package_alias = package_alias + self.image_path = image_path + self.package_name = package_name + self.package_family_name = package_family_name + self.package_full_name = package_full_name + self.display_name = display_name + self.package_relative_path = package_relative_path + self.is_regular_registration = is_regular_registration + self.is_active = is_active + self.package_dependencies = package_dependencies + self.version = version + self.last_updated = last_updated + self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry + self.is_package_timestamped = is_package_timestamped + + +class AppAttachPackageList(_serialization.Model): + """List of App Attach Package definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of App Attach Package definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppAttachPackage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AppAttachPackage"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of App Attach Package definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AppAttachPackagePatch(Resource): + """Schema for patchable App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar tags: tags to be updated. + :vartype tags: dict[str, str] + :ivar properties: Detailed properties for App Attach Package. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties + """ + + _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"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "AppAttachPackagePatchProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AppAttachPackagePatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: Detailed properties for App Attach Package. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class AppAttachPackagePatchProperties(_serialization.Model): + """Schema for patchable fields on an App Attach Package. + + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL of keyvault location to store certificate. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :ivar package_lookback_url: Lookback url to third party control plane, should be null for first + party packages. + :vartype package_lookback_url: str + :ivar custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :vartype custom_data: str + """ + + _attribute_map = { + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + "package_lookback_url": {"key": "packageLookbackUrl", "type": "str"}, + "custom_data": {"key": "customData", "type": "str"}, + } + + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + package_lookback_url: Optional[str] = None, + custom_data: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL of keyvault location to store certificate. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :keyword package_lookback_url: Lookback url to third party control plane, should be null for + first party packages. + :paramtype package_lookback_url: str + :keyword custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :paramtype custom_data: str + """ + super().__init__(**kwargs) + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + self.package_lookback_url = package_lookback_url + self.custom_data = custom_data + + +class AppAttachPackageProperties(_serialization.Model): + """Schema for App Attach Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the App Attach Package. Known values are: + "Succeeded", "Provisioning", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.desktopvirtualization.models.ProvisioningState + :ivar image: Detailed properties for App Attach Package. + :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :ivar host_pool_references: List of Hostpool resource Ids. + :vartype host_pool_references: list[str] + :ivar key_vault_url: URL of keyvault location to store certificate. + :vartype key_vault_url: str + :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :vartype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :ivar package_owner_name: Specific name of package owner, is "AppAttach" for native app attach + packages. + :vartype package_owner_name: str + :ivar package_lookback_url: Lookback url to third party control plane, is null for native app + attach packages. + :vartype package_lookback_url: str + :ivar custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :vartype custom_data: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "image": {"key": "image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + "package_owner_name": {"key": "packageOwnerName", "type": "str"}, + "package_lookback_url": {"key": "packageLookbackUrl", "type": "str"}, + "custom_data": {"key": "customData", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + image: Optional["_models.AppAttachPackageInfoProperties"] = None, + host_pool_references: Optional[List[str]] = None, + key_vault_url: Optional[str] = None, + fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + package_owner_name: Optional[str] = None, + package_lookback_url: Optional[str] = None, + custom_data: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Detailed properties for App Attach Package. + :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties + :keyword host_pool_references: List of Hostpool resource Ids. + :paramtype host_pool_references: list[str] + :keyword key_vault_url: URL of keyvault location to store certificate. + :paramtype key_vault_url: str + :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should + behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and + "DoNotFail". + :paramtype fail_health_check_on_staging_failure: str or + ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :keyword package_owner_name: Specific name of package owner, is "AppAttach" for native app + attach packages. + :paramtype package_owner_name: str + :keyword package_lookback_url: Lookback url to third party control plane, is null for native + app attach packages. + :paramtype package_lookback_url: str + :keyword custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :paramtype custom_data: str + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.provisioning_state = None + self.image = image + self.host_pool_references = host_pool_references + self.key_vault_url = key_vault_url + self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + self.package_owner_name = package_owner_name + self.package_lookback_url = package_lookback_url + self.custom_data = custom_data class Application(Resource): # pylint: disable=too-many-instance-attributes @@ -173,17 +964,18 @@ class Application(Resource): # pylint: disable=too-many-instance-attributes 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. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Application. (internal use). :vartype object_id: str @@ -303,7 +1095,6 @@ def __init__( :paramtype icon_index: int """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -320,21 +1111,28 @@ def __init__( self.icon_content = None -class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ResourceModelWithAllowedPropertySet(TrackedResource): # pylint: disable=too-many-instance-attributes """The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -342,7 +1140,7 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -351,21 +1149,20 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :ivar sku: - :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :ivar plan: - :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, } @@ -374,30 +1171,33 @@ class ResourceModelWithAllowedPropertySet(_serialization.Model): # pylint: disa "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"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -405,29 +1205,20 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :keyword sku: - :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :keyword plan: - :paramtype plan: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan + """ + super().__init__(tags=tags, location=location, **kwargs) self.managed_by = managed_by self.kind = kind self.etag = None - self.tags = tags self.identity = identity self.sku = sku self.plan = plan @@ -438,17 +1229,22 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= 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. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -456,7 +1252,7 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -465,17 +1261,12 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :ivar sku: - :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :ivar plan: - :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of ApplicationGroup. (internal use). :vartype object_id: str :ivar description: Description of ApplicationGroup. @@ -500,9 +1291,10 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "host_pool_arm_path": {"required": True}, "workspace_arm_path": {"readonly": True}, @@ -514,15 +1306,15 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "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"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -536,22 +1328,24 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= def __init__( self, *, + location: str, host_pool_arm_path: str, application_group_type: Union[str, "_models.ApplicationGroupType"], - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, show_in_feed: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -559,19 +1353,15 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :keyword sku: - :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :keyword plan: - :paramtype plan: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword description: Description of ApplicationGroup. :paramtype description: str :keyword friendly_name: Friendly name of ApplicationGroup. @@ -586,16 +1376,15 @@ def __init__( :paramtype show_in_feed: bool """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -641,14 +1430,17 @@ class ApplicationGroupPatch(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] :ivar description: Description of ApplicationGroup. @@ -663,12 +1455,14 @@ class ApplicationGroupPatch(Resource): "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"}, "tags": {"key": "tags", "type": "{str}"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -848,6 +1642,98 @@ def __init__( self.application_type = application_type +class AzureActiveDirectoryInfoProperties(_serialization.Model): + """Azure Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to server. + + :ivar mdm_provider_guid: The Mobile Device Management(MDM) guid. Required. + :vartype mdm_provider_guid: str + """ + + _validation = { + "mdm_provider_guid": {"required": True}, + } + + _attribute_map = { + "mdm_provider_guid": {"key": "mdmProviderGuid", "type": "str"}, + } + + def __init__(self, *, mdm_provider_guid: str, **kwargs: Any) -> None: + """ + :keyword mdm_provider_guid: The Mobile Device Management(MDM) guid. Required. + :paramtype mdm_provider_guid: str + """ + super().__init__(**kwargs) + self.mdm_provider_guid = mdm_provider_guid + + +class BootDiagnosticsInfoPatchProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + +class BootDiagnosticsInfoProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + class CloudErrorProperties(_serialization.Model): """Cloud error object properties. @@ -874,20 +1760,67 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message +class CustomInfoPatchProperties(_serialization.Model): + """Custom image information. + + :ivar resource_id: The resource id of the custom image. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class CustomInfoProperties(_serialization.Model): + """Custom image information. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: The resource id of the custom image. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + class Desktop(Resource): """Schema for Desktop properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Desktop. (internal use). :vartype object_id: str @@ -933,7 +1866,6 @@ def __init__( :paramtype friendly_name: str """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -1010,19 +1942,248 @@ def __init__( self.friendly_name = friendly_name +class DiskInfoPatchProperties(_serialization.Model): + """Disk information. + + :ivar type: The disk type used by virtual machine in hostpool session host. Known values are: + "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.VirtualMachineDiskType"]] = None, **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Known values + are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DiskInfoProperties(_serialization.Model): + """Disk information. + + All required parameters must be populated in order to send to server. + + :ivar type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.VirtualMachineDiskType"], **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DomainInfoPatchProperties(_serialization.Model): + """Domain configurations of session hosts. + + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + + _attribute_map = { + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoPatchProperties"}, + } + + def __init__( + self, *, active_directory_info: Optional["_models.ActiveDirectoryInfoPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + super().__init__(**kwargs) + self.active_directory_info = active_directory_info + + +class DomainInfoProperties(_serialization.Model): + """Domain configurations of session hosts. + + All required parameters must be populated in order to send to server. + + :ivar join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :vartype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :ivar azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :vartype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + + _validation = { + "join_type": {"required": True}, + } + + _attribute_map = { + "join_type": {"key": "joinType", "type": "str"}, + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoProperties"}, + "azure_active_directory_info": { + "key": "azureActiveDirectoryInfo", + "type": "AzureActiveDirectoryInfoProperties", + }, + } + + def __init__( + self, + *, + join_type: Union[str, "_models.DomainJoinType"], + active_directory_info: Optional["_models.ActiveDirectoryInfoProperties"] = None, + azure_active_directory_info: Optional["_models.AzureActiveDirectoryInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :paramtype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :keyword azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :paramtype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + super().__init__(**kwargs) + self.join_type = join_type + self.active_directory_info = active_directory_info + self.azure_active_directory_info = azure_active_directory_info + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.desktopvirtualization.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.desktopvirtualization.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes """Represents the definition of contents retrieved after expanding the MSIX Image. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar package_alias: Alias of MSIX Package. :vartype package_alias: str :ivar image_path: VHD/CIM image path on Network Share. @@ -1052,18 +2213,24 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :ivar package_applications: List of package applications. :vartype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :ivar certificate_name: Certificate name found in the appxmanifest.xml. + :vartype certificate_name: str + :ivar certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :vartype certificate_expiry: ~datetime.datetime """ _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"}, "package_alias": {"key": "properties.packageAlias", "type": "str"}, "image_path": {"key": "properties.imagePath", "type": "str"}, "package_name": {"key": "properties.packageName", "type": "str"}, @@ -1077,6 +2244,8 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes "version": {"key": "properties.version", "type": "str"}, "last_updated": {"key": "properties.lastUpdated", "type": "iso-8601"}, "package_applications": {"key": "properties.packageApplications", "type": "[MsixPackageApplications]"}, + "certificate_name": {"key": "properties.certificateName", "type": "str"}, + "certificate_expiry": {"key": "properties.certificateExpiry", "type": "iso-8601"}, } def __init__( @@ -1095,6 +2264,8 @@ def __init__( version: Optional[str] = None, last_updated: Optional[datetime.datetime] = None, package_applications: Optional[List["_models.MsixPackageApplications"]] = None, + certificate_name: Optional[str] = None, + certificate_expiry: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ @@ -1127,6 +2298,10 @@ def __init__( :keyword package_applications: List of package applications. :paramtype package_applications: list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + :keyword certificate_name: Certificate name found in the appxmanifest.xml. + :paramtype certificate_name: str + :keyword certificate_expiry: Date certificate expires, found in the appxmanifest.xml. + :paramtype certificate_expiry: ~datetime.datetime """ super().__init__(**kwargs) self.package_alias = package_alias @@ -1142,6 +2317,8 @@ def __init__( self.version = version self.last_updated = last_updated self.package_applications = package_applications + self.certificate_name = certificate_name + self.certificate_expiry = certificate_expiry class ExpandMsixImageList(_serialization.Model): @@ -1179,17 +2356,22 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many 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. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -1197,7 +2379,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -1206,17 +2388,12 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :ivar sku: - :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :ivar plan: - :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of HostPool. (internal use). :vartype object_id: str :ivar friendly_name: Friendly name of HostPool. @@ -1235,7 +2412,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :ivar max_session_limit: The max session limit of HostPool. :vartype max_session_limit: int :ivar load_balancer_type: The type of the load balancer. Required. Known values are: - "BreadthFirst", "DepthFirst", and "Persistent". + "BreadthFirst", "DepthFirst", "Persistent", and "MultiplePersistent". :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :ivar ring: The ring number of HostPool. :vartype ring: int @@ -1245,8 +2422,13 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :ivar vm_template: VM template for sessionhosts configuration within hostpool. :vartype vm_template: str + :ivar management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :vartype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :ivar application_group_references: List of applicationGroup links. :vartype application_group_references: list[str] + :ivar app_attach_package_references: List of App Attach Package links. + :vartype app_attach_package_references: list[str] :ivar ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. :vartype ssoadfs_authority: str :ivar sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO @@ -1280,19 +2462,45 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many specified resource. :vartype private_endpoint_connections: list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection] + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "host_pool_type": {"required": True}, "load_balancer_type": {"required": True}, "application_group_references": {"readonly": True}, + "app_attach_package_references": {"readonly": True}, "preferred_app_group_type": {"required": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -1302,15 +2510,15 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "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"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -1323,7 +2531,9 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "validation_environment": {"key": "properties.validationEnvironment", "type": "bool"}, "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfo"}, "vm_template": {"key": "properties.vmTemplate", "type": "str"}, + "management_type": {"key": "properties.managementType", "type": "str"}, "application_group_references": {"key": "properties.applicationGroupReferences", "type": "[str]"}, + "app_attach_package_references": {"key": "properties.appAttachPackageReferences", "type": "[str]"}, "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, "sso_client_id": {"key": "properties.ssoClientId", "type": "str"}, "sso_client_secret_key_vault_path": {"key": "properties.ssoClientSecretKeyVaultPath", "type": "str"}, @@ -1337,21 +2547,25 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, } def __init__( # pylint: disable=too-many-locals self, *, + location: str, host_pool_type: Union[str, "_models.HostPoolType"], load_balancer_type: Union[str, "_models.LoadBalancerType"], preferred_app_group_type: Union[str, "_models.PreferredAppGroupType"], - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, friendly_name: Optional[str] = None, description: Optional[str] = None, personal_desktop_assignment_type: Optional[Union[str, "_models.PersonalDesktopAssignmentType"]] = None, @@ -1361,6 +2575,7 @@ def __init__( # pylint: disable=too-many-locals validation_environment: Optional[bool] = None, registration_info: Optional["_models.RegistrationInfo"] = None, vm_template: Optional[str] = None, + management_type: Optional[Union[str, "_models.ManagementType"]] = None, ssoadfs_authority: Optional[str] = None, sso_client_id: Optional[str] = None, sso_client_secret_key_vault_path: Optional[str] = None, @@ -1368,10 +2583,16 @@ def __init__( # pylint: disable=too-many-locals start_vm_on_connect: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, agent_update: Optional["_models.AgentUpdateProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -1379,19 +2600,15 @@ def __init__( # pylint: disable=too-many-locals it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :keyword sku: - :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :keyword plan: - :paramtype plan: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword friendly_name: Friendly name of HostPool. :paramtype friendly_name: str :keyword description: Description of HostPool. @@ -1408,7 +2625,7 @@ def __init__( # pylint: disable=too-many-locals :keyword max_session_limit: The max session limit of HostPool. :paramtype max_session_limit: int :keyword load_balancer_type: The type of the load balancer. Required. Known values are: - "BreadthFirst", "DepthFirst", and "Persistent". + "BreadthFirst", "DepthFirst", "Persistent", and "MultiplePersistent". :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :keyword ring: The ring number of HostPool. :paramtype ring: int @@ -1418,6 +2635,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :keyword vm_template: VM template for sessionhosts configuration within hostpool. :paramtype vm_template: str + :keyword management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :paramtype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. :paramtype ssoadfs_authority: str :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO @@ -1445,18 +2665,42 @@ def __init__( # pylint: disable=too-many-locals :keyword agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.friendly_name = friendly_name self.description = description @@ -1469,7 +2713,9 @@ def __init__( # pylint: disable=too-many-locals self.validation_environment = validation_environment self.registration_info = registration_info self.vm_template = vm_template + self.management_type = management_type self.application_group_references = None + self.app_attach_package_references = None self.ssoadfs_authority = ssoadfs_authority self.sso_client_id = sso_client_id self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path @@ -1480,6 +2726,10 @@ def __init__( # pylint: disable=too-many-locals self.public_network_access = public_network_access self.agent_update = agent_update self.private_endpoint_connections = None + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp class HostPoolList(_serialization.Model): @@ -1517,14 +2767,17 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] :ivar friendly_name: Friendly name of HostPool. @@ -1540,7 +2793,7 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :vartype personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType :ivar load_balancer_type: The type of the load balancer. Known values are: "BreadthFirst", - "DepthFirst", and "Persistent". + "DepthFirst", "Persistent", and "MultiplePersistent". :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :ivar ring: The ring number of HostPool. :vartype ring: int @@ -1575,170 +2828,604 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :ivar agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :vartype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _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"}, + "tags": {"key": "tags", "type": "{str}"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "custom_rdp_property": {"key": "properties.customRdpProperty", "type": "str"}, + "max_session_limit": {"key": "properties.maxSessionLimit", "type": "int"}, + "personal_desktop_assignment_type": {"key": "properties.personalDesktopAssignmentType", "type": "str"}, + "load_balancer_type": {"key": "properties.loadBalancerType", "type": "str"}, + "ring": {"key": "properties.ring", "type": "int"}, + "validation_environment": {"key": "properties.validationEnvironment", "type": "bool"}, + "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfoPatch"}, + "vm_template": {"key": "properties.vmTemplate", "type": "str"}, + "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, + "sso_client_id": {"key": "properties.ssoClientId", "type": "str"}, + "sso_client_secret_key_vault_path": {"key": "properties.ssoClientSecretKeyVaultPath", "type": "str"}, + "sso_secret_type": {"key": "properties.ssoSecretType", "type": "str"}, + "preferred_app_group_type": {"key": "properties.preferredAppGroupType", "type": "str"}, + "start_vm_on_connect": {"key": "properties.startVMOnConnect", "type": "bool"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "agent_update": {"key": "properties.agentUpdate", "type": "AgentUpdatePatchProperties"}, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + tags: Optional[Dict[str, str]] = None, + friendly_name: Optional[str] = None, + description: Optional[str] = None, + custom_rdp_property: Optional[str] = None, + max_session_limit: Optional[int] = None, + personal_desktop_assignment_type: Optional[Union[str, "_models.PersonalDesktopAssignmentType"]] = None, + load_balancer_type: Optional[Union[str, "_models.LoadBalancerType"]] = None, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["_models.RegistrationInfoPatch"] = None, + vm_template: Optional[str] = None, + ssoadfs_authority: Optional[str] = None, + sso_client_id: Optional[str] = None, + sso_client_secret_key_vault_path: Optional[str] = None, + sso_secret_type: Optional[Union[str, "_models.SSOSecretType"]] = None, + preferred_app_group_type: Optional[Union[str, "_models.PreferredAppGroupType"]] = None, + start_vm_on_connect: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, + agent_update: Optional["_models.AgentUpdatePatchProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword friendly_name: Friendly name of HostPool. + :paramtype friendly_name: str + :keyword description: Description of HostPool. + :paramtype description: str + :keyword custom_rdp_property: Custom rdp property of HostPool. + :paramtype custom_rdp_property: str + :keyword max_session_limit: The max session limit of HostPool. + :paramtype max_session_limit: int + :keyword personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Known + values are: "Automatic" and "Direct". + :paramtype personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :keyword load_balancer_type: The type of the load balancer. Known values are: "BreadthFirst", + "DepthFirst", "Persistent", and "MultiplePersistent". + :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :keyword ring: The ring number of HostPool. + :paramtype ring: int + :keyword validation_environment: Is validation environment. + :paramtype validation_environment: bool + :keyword registration_info: The registration info of HostPool. + :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :keyword vm_template: VM template for sessionhosts configuration within hostpool. + :paramtype vm_template: str + :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :paramtype ssoadfs_authority: str + :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :paramtype sso_client_id: str + :keyword sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :paramtype sso_client_secret_key_vault_path: str + :keyword sso_secret_type: The type of single sign on Secret Type. Known values are: + "SharedKey", "Certificate", "SharedKeyInKeyVault", and "CertificateInKeyVault". + :paramtype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType + :keyword preferred_app_group_type: The type of preferred application group type, default to + Desktop Application Group. Known values are: "None", "Desktop", and "RailApplications". + :paramtype preferred_app_group_type: str or + ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType + :keyword start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :paramtype start_vm_on_connect: bool + :keyword public_network_access: Enabled to allow this resource to be access from the public + network. Known values are: "Enabled", "Disabled", "EnabledForSessionHostsOnly", and + "EnabledForClientsOnly". + :paramtype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess + :keyword agent_update: The session host configuration for updating agent, monitoring agent, and + stack component. + :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP + """ + super().__init__(**kwargs) + self.tags = tags + self.friendly_name = friendly_name + self.description = description + self.custom_rdp_property = custom_rdp_property + self.max_session_limit = max_session_limit + self.personal_desktop_assignment_type = personal_desktop_assignment_type + self.load_balancer_type = load_balancer_type + self.ring = ring + self.validation_environment = validation_environment + self.registration_info = registration_info + self.vm_template = vm_template + self.ssoadfs_authority = ssoadfs_authority + self.sso_client_id = sso_client_id + self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path + self.sso_secret_type = sso_secret_type + self.preferred_app_group_type = preferred_app_group_type + self.start_vm_on_connect = start_vm_on_connect + self.public_network_access = public_network_access + self.agent_update = agent_update + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp + + +class HostPoolUpdateConfigurationPatchProperties(_serialization.Model): # pylint: disable=name-too-long + """The configurations of a hostpool update. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. + :vartype log_off_message: str + """ + + _validation = { + "max_vms_removed": {"minimum": 1}, + "log_off_message": {"max_length": 260}, + } + + _attribute_map = { + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, + } + + def __init__( + self, + *, + delete_original_vm: Optional[bool] = None, + max_vms_removed: Optional[int] = None, + log_off_delay_minutes: Optional[int] = None, + log_off_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. + :paramtype log_off_message: str + """ + super().__init__(**kwargs) + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message + + +class HostPoolUpdateConfigurationProperties(_serialization.Model): + """The configurations of a hostpool update. + + All required parameters must be populated in order to send to server. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :vartype log_off_message: str + """ + + _validation = { + "max_vms_removed": {"required": True, "minimum": 1}, + "log_off_delay_minutes": {"required": True}, + "log_off_message": {"max_length": 260}, + } + + _attribute_map = { + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, + } + + def __init__( + self, + *, + max_vms_removed: int, + log_off_delay_minutes: int, + delete_original_vm: Optional[bool] = None, + log_off_message: str = "", + **kwargs: Any + ) -> None: + """ + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :paramtype log_off_message: str + """ + super().__init__(**kwargs) + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message + + +class HostPoolUpdateControlParameter(_serialization.Model): + """Represents properties for a hostpool update control request. + + All required parameters must be populated in order to send to server. + + :ivar action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :vartype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :ivar cancel_message: The cancel message sent to the user on the session host. This is can only + be specified if the action is 'Cancel'. + :vartype cancel_message: str + """ + + _validation = { + "action": {"required": True}, + "cancel_message": {"max_length": 260}, + } + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + "cancel_message": {"key": "cancelMessage", "type": "str"}, + } + + def __init__( + self, *, action: Union[str, "_models.HostPoolUpdateAction"], cancel_message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :paramtype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :keyword cancel_message: The cancel message sent to the user on the session host. This is can + only be specified if the action is 'Cancel'. + :paramtype cancel_message: str + """ + super().__init__(**kwargs) + self.action = action + self.cancel_message = cancel_message + + +class HostPoolUpdateFault(_serialization.Model): + """Hostpool update fault information. + + :ivar fault_type: Hostpool update fault type. Known values are: "ServiceError" and "UserError". + :vartype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :ivar fault_code: Hostpool update fault code. + :vartype fault_code: str + :ivar fault_text: Hostpool update fault text. + :vartype fault_text: str + :ivar fault_context: Hostpool update fault context. + :vartype fault_context: str + """ + + _attribute_map = { + "fault_type": {"key": "faultType", "type": "str"}, + "fault_code": {"key": "faultCode", "type": "str"}, + "fault_text": {"key": "faultText", "type": "str"}, + "fault_context": {"key": "faultContext", "type": "str"}, + } + + def __init__( + self, + *, + fault_type: Optional[Union[str, "_models.FaultType"]] = None, + fault_code: Optional[str] = None, + fault_text: Optional[str] = None, + fault_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword fault_type: Hostpool update fault type. Known values are: "ServiceError" and + "UserError". + :paramtype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :keyword fault_code: Hostpool update fault code. + :paramtype fault_code: str + :keyword fault_text: Hostpool update fault text. + :paramtype fault_text: str + :keyword fault_context: Hostpool update fault context. + :paramtype fault_context: str + """ + super().__init__(**kwargs) + self.fault_type = fault_type + self.fault_code = fault_code + self.fault_text = fault_text + self.fault_context = fault_context + + +class ImageInfoPatchProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + :ivar image_type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :vartype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + + _attribute_map = { + "image_type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoPatchProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoPatchProperties"}, + } + + def __init__( + self, + *, + image_type: Optional[Union[str, "_models.Type"]] = None, + marketplace_info: Optional["_models.MarketplaceInfoPatchProperties"] = None, + custom_info: Optional["_models.CustomInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image_type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :paramtype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + super().__init__(**kwargs) + self.image_type = image_type + self.marketplace_info = marketplace_info + self.custom_info = custom_info + + +class ImageInfoProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + All required parameters must be populated in order to send to server. + + :ivar image_type: The type of image session hosts use in the hostpool. Required. Known values + are: "Marketplace" and "Custom". + :vartype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + + _validation = { + "image_type": {"required": True}, + } + + _attribute_map = { + "image_type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoProperties"}, + } + + def __init__( + self, + *, + image_type: Union[str, "_models.Type"], + marketplace_info: Optional["_models.MarketplaceInfoProperties"] = None, + custom_info: Optional["_models.CustomInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image_type: The type of image session hosts use in the hostpool. Required. Known + values are: "Marketplace" and "Custom". + :paramtype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + super().__init__(**kwargs) + self.image_type = image_type + self.marketplace_info = marketplace_info + self.custom_info = custom_info + + +class ImportPackageInfoRequest(_serialization.Model): + """Information to import app attach package. + + :ivar path: URI to Image. + :vartype path: str + :ivar package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :vartype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "package_architecture": {"key": "packageArchitecture", "type": "str"}, } + def __init__( + self, + *, + path: Optional[str] = None, + package_architecture: Optional[Union[str, "_models.AppAttachPackageArchitectures"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: URI to Image. + :paramtype path: str + :keyword package_architecture: Possible device architectures that an app attach package can be + configured for. Known values are: "ARM", "ARM64", "x86", "x64", "Neutral", "x86a64", and "ALL". + :paramtype package_architecture: str or + ~azure.mgmt.desktopvirtualization.models.AppAttachPackageArchitectures + """ + super().__init__(**kwargs) + self.path = path + self.package_architecture = package_architecture + + +class KeyVaultCredentialsPatchProperties(_serialization.Model): + """Credentials kept in the keyvault. + + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. + :vartype password_key_vault_secret_uri: str + """ + _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "custom_rdp_property": {"key": "properties.customRdpProperty", "type": "str"}, - "max_session_limit": {"key": "properties.maxSessionLimit", "type": "int"}, - "personal_desktop_assignment_type": {"key": "properties.personalDesktopAssignmentType", "type": "str"}, - "load_balancer_type": {"key": "properties.loadBalancerType", "type": "str"}, - "ring": {"key": "properties.ring", "type": "int"}, - "validation_environment": {"key": "properties.validationEnvironment", "type": "bool"}, - "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfoPatch"}, - "vm_template": {"key": "properties.vmTemplate", "type": "str"}, - "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, - "sso_client_id": {"key": "properties.ssoClientId", "type": "str"}, - "sso_client_secret_key_vault_path": {"key": "properties.ssoClientSecretKeyVaultPath", "type": "str"}, - "sso_secret_type": {"key": "properties.ssoSecretType", "type": "str"}, - "preferred_app_group_type": {"key": "properties.preferredAppGroupType", "type": "str"}, - "start_vm_on_connect": {"key": "properties.startVMOnConnect", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "agent_update": {"key": "properties.agentUpdate", "type": "AgentUpdatePatchProperties"}, + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - friendly_name: Optional[str] = None, - description: Optional[str] = None, - custom_rdp_property: Optional[str] = None, - max_session_limit: Optional[int] = None, - personal_desktop_assignment_type: Optional[Union[str, "_models.PersonalDesktopAssignmentType"]] = None, - load_balancer_type: Optional[Union[str, "_models.LoadBalancerType"]] = None, - ring: Optional[int] = None, - validation_environment: Optional[bool] = None, - registration_info: Optional["_models.RegistrationInfoPatch"] = None, - vm_template: Optional[str] = None, - ssoadfs_authority: Optional[str] = None, - sso_client_id: Optional[str] = None, - sso_client_secret_key_vault_path: Optional[str] = None, - sso_secret_type: Optional[Union[str, "_models.SSOSecretType"]] = None, - preferred_app_group_type: Optional[Union[str, "_models.PreferredAppGroupType"]] = None, - start_vm_on_connect: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, - agent_update: Optional["_models.AgentUpdatePatchProperties"] = None, + username_key_vault_secret_uri: Optional[str] = None, + password_key_vault_secret_uri: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] - :keyword friendly_name: Friendly name of HostPool. - :paramtype friendly_name: str - :keyword description: Description of HostPool. - :paramtype description: str - :keyword custom_rdp_property: Custom rdp property of HostPool. - :paramtype custom_rdp_property: str - :keyword max_session_limit: The max session limit of HostPool. - :paramtype max_session_limit: int - :keyword personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Known - values are: "Automatic" and "Direct". - :paramtype personal_desktop_assignment_type: str or - ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType - :keyword load_balancer_type: The type of the load balancer. Known values are: "BreadthFirst", - "DepthFirst", and "Persistent". - :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType - :keyword ring: The ring number of HostPool. - :paramtype ring: int - :keyword validation_environment: Is validation environment. - :paramtype validation_environment: bool - :keyword registration_info: The registration info of HostPool. - :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch - :keyword vm_template: VM template for sessionhosts configuration within hostpool. - :paramtype vm_template: str - :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. - :paramtype ssoadfs_authority: str - :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO - certificates. - :paramtype sso_client_id: str - :keyword sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for - communication to ADFS. - :paramtype sso_client_secret_key_vault_path: str - :keyword sso_secret_type: The type of single sign on Secret Type. Known values are: - "SharedKey", "Certificate", "SharedKeyInKeyVault", and "CertificateInKeyVault". - :paramtype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType - :keyword preferred_app_group_type: The type of preferred application group type, default to - Desktop Application Group. Known values are: "None", "Desktop", and "RailApplications". - :paramtype preferred_app_group_type: str or - ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType - :keyword start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. - :paramtype start_vm_on_connect: bool - :keyword public_network_access: Enabled to allow this resource to be access from the public - network. Known values are: "Enabled", "Disabled", "EnabledForSessionHostsOnly", and - "EnabledForClientsOnly". - :paramtype public_network_access: str or - ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess - :keyword agent_update: The session host configuration for updating agent, monitoring agent, and - stack component. - :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. + :paramtype password_key_vault_secret_uri: str """ super().__init__(**kwargs) - self.tags = tags - self.friendly_name = friendly_name - self.description = description - self.custom_rdp_property = custom_rdp_property - self.max_session_limit = max_session_limit - self.personal_desktop_assignment_type = personal_desktop_assignment_type - self.load_balancer_type = load_balancer_type - self.ring = ring - self.validation_environment = validation_environment - self.registration_info = registration_info - self.vm_template = vm_template - self.ssoadfs_authority = ssoadfs_authority - self.sso_client_id = sso_client_id - self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path - self.sso_secret_type = sso_secret_type - self.preferred_app_group_type = preferred_app_group_type - self.start_vm_on_connect = start_vm_on_connect - self.public_network_access = public_network_access - self.agent_update = agent_update + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri -class Identity(_serialization.Model): - """Identity for the resource. +class KeyVaultCredentialsProperties(_serialization.Model): + """Credentials kept in the keyvault. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar 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 + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. Required. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. Required. + :vartype password_key_vault_secret_uri: str """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, + "username_key_vault_secret_uri": {"required": True}, + "password_key_vault_secret_uri": {"required": True}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, username_key_vault_secret_uri: str, password_key_vault_secret_uri: str, **kwargs: Any + ) -> None: """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. Required. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. Required. + :paramtype password_key_vault_secret_uri: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri class LogSpecification(_serialization.Model): @@ -1848,6 +3535,163 @@ def __init__( self.day_of_week = day_of_week +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar 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). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.desktopvirtualization.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}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.desktopvirtualization.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.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}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.desktopvirtualization.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MarketplaceInfoPatchProperties(_serialization.Model): + """Marketplace image information. + + :ivar offer: The offer of the image. + :vartype offer: str + :ivar publisher: The publisher of the image. + :vartype publisher: str + :ivar sku: The sku of the image. + :vartype sku: str + :ivar exact_version: The exact version of the image. + :vartype exact_version: str + """ + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__( + self, + *, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + exact_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword offer: The offer of the image. + :paramtype offer: str + :keyword publisher: The publisher of the image. + :paramtype publisher: str + :keyword sku: The sku of the image. + :paramtype sku: str + :keyword exact_version: The exact version of the image. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + +class MarketplaceInfoProperties(_serialization.Model): + """Marketplace image information. + + All required parameters must be populated in order to send to server. + + :ivar offer: The offer of the image. Required. + :vartype offer: str + :ivar publisher: The publisher of the image. Required. + :vartype publisher: str + :ivar sku: The sku of the image. Required. + :vartype sku: str + :ivar exact_version: The exact version of the image. Required. + :vartype exact_version: str + """ + + _validation = { + "offer": {"required": True}, + "publisher": {"required": True}, + "sku": {"required": True}, + "exact_version": {"required": True}, + } + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__(self, *, offer: str, publisher: str, sku: str, exact_version: str, **kwargs: Any) -> None: + """ + :keyword offer: The offer of the image. Required. + :paramtype offer: str + :keyword publisher: The publisher of the image. Required. + :paramtype publisher: str + :keyword sku: The sku of the image. Required. + :paramtype sku: str + :keyword exact_version: The exact version of the image. Required. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + class MSIXImageURI(_serialization.Model): """Represents URI referring to MSIX Image. @@ -1873,15 +3717,16 @@ class MSIXPackage(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData :ivar image_path: VHD/CIM image path on Network Share. :vartype image_path: str @@ -1979,7 +3824,6 @@ def __init__( list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] """ super().__init__(**kwargs) - self.system_data = None self.image_path = image_path self.package_name = package_name self.package_family_name = package_family_name @@ -2065,7 +3909,9 @@ def __init__( class MsixPackageDependencies(_serialization.Model): """Schema for MSIX Package Dependencies properties. - :ivar dependency_name: Name of package dependency. + :ivar dependency_name: Name of the package dependency. For Msix packages, this is the other + packages this package depends upon, for APP-V packages this is the locations of the user and + deployment config files. :vartype dependency_name: str :ivar publisher: Name of dependency publisher. :vartype publisher: str @@ -2088,7 +3934,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword dependency_name: Name of package dependency. + :keyword dependency_name: Name of the package dependency. For Msix packages, this is the other + packages this package depends upon, for APP-V packages this is the locations of the user and + deployment config files. :paramtype dependency_name: str :keyword publisher: Name of dependency publisher. :paramtype publisher: str @@ -2136,14 +3984,17 @@ class MSIXPackagePatch(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar is_active: Set a version of the package to be active across hostpool. :vartype is_active: bool :ivar is_regular_registration: Set Registration mode. Regular or Delayed. @@ -2153,40 +4004,106 @@ class MSIXPackagePatch(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "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"}, + "is_active": {"key": "properties.isActive", "type": "bool"}, + "is_regular_registration": {"key": "properties.isRegularRegistration", "type": "bool"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + } + + def __init__( + self, + *, + is_active: Optional[bool] = None, + is_regular_registration: Optional[bool] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_active: Set a version of the package to be active across hostpool. + :paramtype is_active: bool + :keyword is_regular_registration: Set Registration mode. Regular or Delayed. + :paramtype is_regular_registration: bool + :keyword display_name: Display name for MSIX Package. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.is_active = is_active + self.is_regular_registration = is_regular_registration + self.display_name = display_name + + +class NetworkInfoPatchProperties(_serialization.Model): + """Network information. + + :ivar subnet_id: The resource ID of the subnet. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the Network Security Group(NSG). + :vartype security_group_id: str + """ + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__( + self, *, subnet_id: Optional[str] = None, security_group_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword subnet_id: The resource ID of the subnet. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the Network Security Group(NSG). + :paramtype security_group_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.security_group_id = security_group_id + + +class NetworkInfoProperties(_serialization.Model): + """Network information. + + All required parameters must be populated in order to send to server. + + :ivar subnet_id: The resource ID of the subnet. Required. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the Network Security Group(NSG). + :vartype security_group_id: str + """ + + _validation = { + "subnet_id": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "is_active": {"key": "properties.isActive", "type": "bool"}, - "is_regular_registration": {"key": "properties.isRegularRegistration", "type": "bool"}, - "display_name": {"key": "properties.displayName", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, } - def __init__( - self, - *, - is_active: Optional[bool] = None, - is_regular_registration: Optional[bool] = None, - display_name: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, subnet_id: str, security_group_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword is_active: Set a version of the package to be active across hostpool. - :paramtype is_active: bool - :keyword is_regular_registration: Set Registration mode. Regular or Delayed. - :paramtype is_regular_registration: bool - :keyword display_name: Display name for MSIX Package. - :paramtype display_name: str + :keyword subnet_id: The resource ID of the subnet. Required. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the Network Security Group(NSG). + :paramtype security_group_id: str """ super().__init__(**kwargs) - self.is_active = is_active - self.is_regular_registration = is_regular_registration - self.display_name = display_name + self.subnet_id = subnet_id + self.security_group_id = security_group_id class OperationProperties(_serialization.Model): @@ -2214,7 +4131,7 @@ def __init__( class Plan(_serialization.Model): """Plan for the resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. :vartype name: str @@ -2279,11 +4196,11 @@ def __init__( class PrivateEndpoint(_serialization.Model): - """The Private Endpoint resource. + """The private endpoint resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ARM identifier for Private Endpoint. + :ivar id: The ARM identifier for private endpoint. :vartype id: str """ @@ -2302,19 +4219,24 @@ def __init__(self, **kwargs: Any) -> None: class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. + """The private endpoint connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar private_endpoint: The resource of private end point. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2330,6 +4252,8 @@ class PrivateEndpointConnection(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -2337,6 +4261,8 @@ class PrivateEndpointConnection(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, "private_link_service_connection_state": { "key": "properties.privateLinkServiceConnectionState", @@ -2353,7 +4279,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword private_endpoint: The resource of private end point. + :keyword private_endpoint: The private endpoint resource. :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :keyword private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2361,12 +4287,13 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) + self.group_ids = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None -class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): +class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): # pylint: disable=name-too-long """List of private endpoint connection associated with the specified storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -2405,15 +4332,20 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar private_endpoint: The resource of private end point. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the connection between service consumer and provider. @@ -2423,67 +4355,25 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): Known values are: "Succeeded", "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState - """ - super().__init__( - private_endpoint=private_endpoint, - private_link_service_connection_state=private_link_service_connection_state, - **kwargs - ) - self.system_data = None - class PrivateLinkResource(Resource): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. @@ -2496,6 +4386,7 @@ class PrivateLinkResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "group_id": {"readonly": True}, "required_members": {"readonly": True}, } @@ -2504,6 +4395,7 @@ class PrivateLinkResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "group_id": {"key": "properties.groupId", "type": "str"}, "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, @@ -2602,32 +4494,19 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class RegistrationInfo(_serialization.Model): """Represents a RegistrationInfo definition. @@ -2708,233 +4587,62 @@ def __init__( self.registration_token_operation = registration_token_operation -class ResourceModelWithAllowedPropertySetIdentity(Identity): - """ResourceModelWithAllowedPropertySetIdentity. +class RegistrationTokenList(_serialization.Model): + """List of RegistrationToken definitions. 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: Any) -> None: - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(type=type, **kwargs) - - -class ResourceModelWithAllowedPropertySetPlan(Plan): - """ResourceModelWithAllowedPropertySetPlan. - - All required parameters must be populated in order to send to Azure. - - :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. - :vartype name: str - :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. - Required. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to - the OfferID specified for the artifact at the time of Data Market onboarding. Required. - :vartype product: str - :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the - said product/artifact. - :vartype promotion_code: str - :ivar version: The version of the desired product/artifact. - :vartype version: str - """ - - _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "product": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - "promotion_code": {"key": "promotionCode", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - publisher: str, - product: str, - promotion_code: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: A user defined name of the 3rd Party Artifact that is being procured. Required. - :paramtype name: str - :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. Required. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to - the OfferID specified for the artifact at the time of Data Market onboarding. Required. - :paramtype product: str - :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :paramtype promotion_code: str - :keyword version: The version of the desired product/artifact. - :paramtype version: str - """ - super().__init__( - name=name, publisher=publisher, product=product, promotion_code=promotion_code, version=version, **kwargs - ) - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int + :ivar value: List of RegistrationToken definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.RegistrationTokenMinimal] + :ivar next_link: Link to the next page of results. + :vartype next_link: str """ _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - - -class ResourceModelWithAllowedPropertySetSku(Sku): - """ResourceModelWithAllowedPropertySetSku. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - """ + "next_link": {"readonly": True}, + } - _validation = { - "name": {"required": True}, + _attribute_map = { + "value": {"key": "value", "type": "[RegistrationTokenMinimal]"}, + "next_link": {"key": "nextLink", "type": "str"}, } + def __init__(self, *, value: Optional[List["_models.RegistrationTokenMinimal"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of RegistrationToken definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.RegistrationTokenMinimal] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class RegistrationTokenMinimal(_serialization.Model): + """Represents a Minimal set of properties for RegistrationToken definition. + + :ivar expiration_time: Expiration time of registration token. + :vartype expiration_time: ~datetime.datetime + :ivar token: The registration token base64 encoded string. + :vartype token: str + """ + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, + "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + "token": {"key": "token", "type": "str"}, } def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs: Any + self, *, expiration_time: Optional[datetime.datetime] = None, token: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int + :keyword expiration_time: Expiration time of registration token. + :paramtype expiration_time: ~datetime.datetime + :keyword token: The registration token base64 encoded string. + :paramtype token: str """ - super().__init__(name=name, tier=tier, size=size, family=family, capacity=capacity, **kwargs) + super().__init__(**kwargs) + self.expiration_time = expiration_time + self.token = token class ResourceProviderOperation(_serialization.Model): @@ -3092,17 +4800,22 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m 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. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -3110,7 +4823,7 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -3119,17 +4832,12 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :ivar sku: - :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :ivar plan: - :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of scaling plan. (internal use). :vartype object_id: str :ivar description: Description of scaling plan. @@ -3138,11 +4846,11 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m :vartype friendly_name: str :ivar time_zone: Timezone of the scaling plan. Required. :vartype time_zone: str - :ivar host_pool_type: HostPool type for desktop. "Pooled" + :ivar host_pool_type: HostPool type for desktop. Known values are: "Pooled" and "Personal". :vartype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType :ivar exclusion_tag: Exclusion tag for scaling plan. :vartype exclusion_tag: str - :ivar schedules: List of ScalingPlanPooledSchedule definitions. + :ivar schedules: List of Pooled ScalingSchedule definitions. :vartype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] :ivar host_pool_references: List of ScalingHostPoolReference definitions. :vartype host_pool_references: @@ -3153,9 +4861,10 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "time_zone": {"required": True}, } @@ -3164,15 +4873,15 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "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"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -3186,14 +4895,14 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m def __init__( self, *, + location: str, time_zone: str, - location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, host_pool_type: Union[str, "_models.ScalingHostPoolType"] = "Pooled", @@ -3203,7 +4912,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -3211,46 +4922,41 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :keyword sku: - :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :keyword plan: - :paramtype plan: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword description: Description of scaling plan. :paramtype description: str :keyword friendly_name: User friendly name of scaling plan. :paramtype friendly_name: str :keyword time_zone: Timezone of the scaling plan. Required. :paramtype time_zone: str - :keyword host_pool_type: HostPool type for desktop. "Pooled" + :keyword host_pool_type: HostPool type for desktop. Known values are: "Pooled" and "Personal". :paramtype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType :keyword exclusion_tag: Exclusion tag for scaling plan. :paramtype exclusion_tag: str - :keyword schedules: List of ScalingPlanPooledSchedule definitions. + :keyword schedules: List of Pooled ScalingSchedule definitions. :paramtype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] :keyword host_pool_references: List of ScalingHostPoolReference definitions. :paramtype host_pool_references: list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name @@ -3304,7 +5010,7 @@ class ScalingPlanPatch(_serialization.Model): :vartype time_zone: str :ivar exclusion_tag: Exclusion tag for scaling plan. :vartype exclusion_tag: str - :ivar schedules: List of ScalingSchedule definitions. + :ivar schedules: List Pooled ScalingSchedule definitions. :vartype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] :ivar host_pool_references: List of ScalingHostPoolReference definitions. :vartype host_pool_references: @@ -3344,7 +5050,7 @@ def __init__( :paramtype time_zone: str :keyword exclusion_tag: Exclusion tag for scaling plan. :paramtype exclusion_tag: str - :keyword schedules: List of ScalingSchedule definitions. + :keyword schedules: List Pooled ScalingSchedule definitions. :paramtype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] :keyword host_pool_references: List of ScalingHostPoolReference definitions. :paramtype host_pool_references: @@ -3365,19 +5071,22 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData - :ivar days_of_week: Set of days of the week on which this schedule is active. + :ivar days_of_week: Set of days of the week on which this schedule is active. Required. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] - :ivar ramp_up_start_time: Starting time for ramp up period. + :ivar ramp_up_start_time: Starting time for ramp up period. Required. :vartype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar ramp_up_auto_start_hosts: The desired startup behavior during the ramp up period for personal vms in the hostpool. Known values are: "None", "WithAssignedUser", and "All". @@ -3402,7 +5111,7 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in :ivar ramp_up_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. :vartype ramp_up_minutes_to_wait_on_logoff: int - :ivar peak_start_time: Starting time for peak period. + :ivar peak_start_time: Starting time for peak period. Required. :vartype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar peak_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the peak phase. Known values are: "Enable" and "Disable". @@ -3422,7 +5131,7 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in :ivar peak_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. :vartype peak_minutes_to_wait_on_logoff: int - :ivar ramp_down_start_time: Starting time for ramp down period. + :ivar ramp_down_start_time: Starting time for ramp down period. Required. :vartype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar ramp_down_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. Known values are: "Enable" and "Disable". @@ -3442,7 +5151,7 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in :ivar ramp_down_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. :vartype ramp_down_minutes_to_wait_on_logoff: int - :ivar off_peak_start_time: Starting time for off-peak period. + :ivar off_peak_start_time: Starting time for off-peak period. Required. :vartype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar off_peak_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. Known values are: "Enable" and "Disable". @@ -3469,12 +5178,17 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "days_of_week": {"required": True}, + "ramp_up_start_time": {"required": True}, "ramp_up_minutes_to_wait_on_disconnect": {"minimum": 0}, "ramp_up_minutes_to_wait_on_logoff": {"minimum": 0}, + "peak_start_time": {"required": True}, "peak_minutes_to_wait_on_disconnect": {"minimum": 0}, "peak_minutes_to_wait_on_logoff": {"minimum": 0}, + "ramp_down_start_time": {"required": True}, "ramp_down_minutes_to_wait_on_disconnect": {"minimum": 0}, "ramp_down_minutes_to_wait_on_logoff": {"minimum": 0}, + "off_peak_start_time": {"required": True}, "off_peak_minutes_to_wait_on_disconnect": {"minimum": 0}, "off_peak_minutes_to_wait_on_logoff": {"minimum": 0}, } @@ -3518,27 +5232,27 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in def __init__( # pylint: disable=too-many-locals self, *, - days_of_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, - ramp_up_start_time: Optional["_models.Time"] = None, + days_of_week: List[Union[str, "_models.DayOfWeek"]], + ramp_up_start_time: "_models.Time", + peak_start_time: "_models.Time", + ramp_down_start_time: "_models.Time", + off_peak_start_time: "_models.Time", ramp_up_auto_start_hosts: Optional[Union[str, "_models.StartupBehavior"]] = None, ramp_up_start_vm_on_connect: Optional[Union[str, "_models.SetStartVMOnConnect"]] = None, ramp_up_action_on_disconnect: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, ramp_up_minutes_to_wait_on_disconnect: Optional[int] = None, ramp_up_action_on_logoff: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, ramp_up_minutes_to_wait_on_logoff: Optional[int] = None, - peak_start_time: Optional["_models.Time"] = None, peak_start_vm_on_connect: Optional[Union[str, "_models.SetStartVMOnConnect"]] = None, peak_action_on_disconnect: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, peak_minutes_to_wait_on_disconnect: Optional[int] = None, peak_action_on_logoff: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, peak_minutes_to_wait_on_logoff: Optional[int] = None, - ramp_down_start_time: Optional["_models.Time"] = None, ramp_down_start_vm_on_connect: Optional[Union[str, "_models.SetStartVMOnConnect"]] = None, ramp_down_action_on_disconnect: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, ramp_down_minutes_to_wait_on_disconnect: Optional[int] = None, ramp_down_action_on_logoff: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, ramp_down_minutes_to_wait_on_logoff: Optional[int] = None, - off_peak_start_time: Optional["_models.Time"] = None, off_peak_start_vm_on_connect: Optional[Union[str, "_models.SetStartVMOnConnect"]] = None, off_peak_action_on_disconnect: Optional[Union[str, "_models.SessionHandlingOperation"]] = None, off_peak_minutes_to_wait_on_disconnect: Optional[int] = None, @@ -3547,9 +5261,9 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword days_of_week: Set of days of the week on which this schedule is active. + :keyword days_of_week: Set of days of the week on which this schedule is active. Required. :paramtype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] - :keyword ramp_up_start_time: Starting time for ramp up period. + :keyword ramp_up_start_time: Starting time for ramp up period. Required. :paramtype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword ramp_up_auto_start_hosts: The desired startup behavior during the ramp up period for personal vms in the hostpool. Known values are: "None", "WithAssignedUser", and "All". @@ -3574,7 +5288,7 @@ def __init__( # pylint: disable=too-many-locals :keyword ramp_up_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. :paramtype ramp_up_minutes_to_wait_on_logoff: int - :keyword peak_start_time: Starting time for peak period. + :keyword peak_start_time: Starting time for peak period. Required. :paramtype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword peak_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the peak phase. Known values are: "Enable" and "Disable". @@ -3594,7 +5308,7 @@ def __init__( # pylint: disable=too-many-locals :keyword peak_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. :paramtype peak_minutes_to_wait_on_logoff: int - :keyword ramp_down_start_time: Starting time for ramp down period. + :keyword ramp_down_start_time: Starting time for ramp down period. Required. :paramtype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword ramp_down_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. Known values are: "Enable" and "Disable". @@ -3614,7 +5328,7 @@ def __init__( # pylint: disable=too-many-locals :keyword ramp_down_minutes_to_wait_on_logoff: The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. :paramtype ramp_down_minutes_to_wait_on_logoff: int - :keyword off_peak_start_time: Starting time for off-peak period. + :keyword off_peak_start_time: Starting time for off-peak period. Required. :paramtype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword off_peak_start_vm_on_connect: The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. Known values are: "Enable" and "Disable". @@ -3636,7 +5350,6 @@ def __init__( # pylint: disable=too-many-locals :paramtype off_peak_minutes_to_wait_on_logoff: int """ super().__init__(**kwargs) - self.system_data = None self.days_of_week = days_of_week self.ramp_up_start_time = ramp_up_start_time self.ramp_up_auto_start_hosts = ramp_up_auto_start_hosts @@ -3984,19 +5697,24 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData - :ivar days_of_week: Set of days of the week on which this schedule is active. + :ivar name_properties_name: Name of the ScalingPlanPooledSchedule. + :vartype name_properties_name: str + :ivar days_of_week: Set of days of the week on which this schedule is active. Required. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] - :ivar ramp_up_start_time: Starting time for ramp up period. + :ivar ramp_up_start_time: Starting time for ramp up period. Required. :vartype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4004,15 +5722,15 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm :ivar ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. :vartype ramp_up_minimum_hosts_pct: int - :ivar ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :ivar ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. Required. :vartype ramp_up_capacity_threshold_pct: int - :ivar peak_start_time: Starting time for peak period. + :ivar peak_start_time: Starting time for peak period. Required. :vartype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar peak_load_balancing_algorithm: Load balancing algorithm for peak period. Known values are: "BreadthFirst" and "DepthFirst". :vartype peak_load_balancing_algorithm: str or ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm - :ivar ramp_down_start_time: Starting time for ramp down period. + :ivar ramp_down_start_time: Starting time for ramp down period. Required. :vartype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4020,7 +5738,7 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm :ivar ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. :vartype ramp_down_minimum_hosts_pct: int - :ivar ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :ivar ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. Required. :vartype ramp_down_capacity_threshold_pct: int :ivar ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. :vartype ramp_down_force_logoff_users: bool @@ -4033,7 +5751,7 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- :vartype ramp_down_wait_time_minutes: int :ivar ramp_down_notification_message: Notification message for users during ramp down period. :vartype ramp_down_notification_message: str - :ivar off_peak_start_time: Starting time for off-peak period. + :ivar off_peak_start_time: Starting time for off-peak period. Required. :vartype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4046,10 +5764,16 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "name_properties_name": {"readonly": True}, + "days_of_week": {"required": True}, + "ramp_up_start_time": {"required": True}, "ramp_up_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, - "ramp_up_capacity_threshold_pct": {"maximum": 100, "minimum": 1}, + "ramp_up_capacity_threshold_pct": {"required": True, "maximum": 100, "minimum": 1}, + "peak_start_time": {"required": True}, + "ramp_down_start_time": {"required": True}, "ramp_down_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, - "ramp_down_capacity_threshold_pct": {"maximum": 100, "minimum": 1}, + "ramp_down_capacity_threshold_pct": {"required": True, "maximum": 100, "minimum": 1}, + "off_peak_start_time": {"required": True}, } _attribute_map = { @@ -4057,6 +5781,7 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "name_properties_name": {"key": "properties.name", "type": "str"}, "days_of_week": {"key": "properties.daysOfWeek", "type": "[str]"}, "ramp_up_start_time": {"key": "properties.rampUpStartTime", "type": "Time"}, "ramp_up_load_balancing_algorithm": {"key": "properties.rampUpLoadBalancingAlgorithm", "type": "str"}, @@ -4079,29 +5804,29 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- def __init__( self, *, - days_of_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, - ramp_up_start_time: Optional["_models.Time"] = None, + days_of_week: List[Union[str, "_models.DayOfWeek"]], + ramp_up_start_time: "_models.Time", + ramp_up_capacity_threshold_pct: int, + peak_start_time: "_models.Time", + ramp_down_start_time: "_models.Time", + ramp_down_capacity_threshold_pct: int, + off_peak_start_time: "_models.Time", ramp_up_load_balancing_algorithm: Optional[Union[str, "_models.SessionHostLoadBalancingAlgorithm"]] = None, ramp_up_minimum_hosts_pct: Optional[int] = None, - ramp_up_capacity_threshold_pct: Optional[int] = None, - peak_start_time: Optional["_models.Time"] = None, peak_load_balancing_algorithm: Optional[Union[str, "_models.SessionHostLoadBalancingAlgorithm"]] = None, - ramp_down_start_time: Optional["_models.Time"] = None, ramp_down_load_balancing_algorithm: Optional[Union[str, "_models.SessionHostLoadBalancingAlgorithm"]] = None, ramp_down_minimum_hosts_pct: Optional[int] = None, - ramp_down_capacity_threshold_pct: Optional[int] = None, ramp_down_force_logoff_users: Optional[bool] = None, ramp_down_stop_hosts_when: Optional[Union[str, "_models.StopHostsWhen"]] = None, ramp_down_wait_time_minutes: Optional[int] = None, ramp_down_notification_message: Optional[str] = None, - off_peak_start_time: Optional["_models.Time"] = None, off_peak_load_balancing_algorithm: Optional[Union[str, "_models.SessionHostLoadBalancingAlgorithm"]] = None, **kwargs: Any ) -> None: """ - :keyword days_of_week: Set of days of the week on which this schedule is active. + :keyword days_of_week: Set of days of the week on which this schedule is active. Required. :paramtype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] - :keyword ramp_up_start_time: Starting time for ramp up period. + :keyword ramp_up_start_time: Starting time for ramp up period. Required. :paramtype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4109,15 +5834,15 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm :keyword ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. :paramtype ramp_up_minimum_hosts_pct: int - :keyword ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :keyword ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. Required. :paramtype ramp_up_capacity_threshold_pct: int - :keyword peak_start_time: Starting time for peak period. + :keyword peak_start_time: Starting time for peak period. Required. :paramtype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword peak_load_balancing_algorithm: Load balancing algorithm for peak period. Known values are: "BreadthFirst" and "DepthFirst". :paramtype peak_load_balancing_algorithm: str or ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm - :keyword ramp_down_start_time: Starting time for ramp down period. + :keyword ramp_down_start_time: Starting time for ramp down period. Required. :paramtype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4125,7 +5850,7 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm :keyword ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. :paramtype ramp_down_minimum_hosts_pct: int - :keyword ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :keyword ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. Required. :paramtype ramp_down_capacity_threshold_pct: int :keyword ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. :paramtype ramp_down_force_logoff_users: bool @@ -4139,7 +5864,7 @@ def __init__( :keyword ramp_down_notification_message: Notification message for users during ramp down period. :paramtype ramp_down_notification_message: str - :keyword off_peak_start_time: Starting time for off-peak period. + :keyword off_peak_start_time: Starting time for off-peak period. Required. :paramtype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. Known values are: "BreadthFirst" and "DepthFirst". @@ -4147,7 +5872,7 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ super().__init__(**kwargs) - self.system_data = None + self.name_properties_name = None self.days_of_week = days_of_week self.ramp_up_start_time = ramp_up_start_time self.ramp_up_load_balancing_algorithm = ramp_up_load_balancing_algorithm @@ -4202,14 +5927,19 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar name_properties_name: Name of the ScalingPlanPooledSchedule. + :vartype name_properties_name: str :ivar days_of_week: Set of days of the week on which this schedule is active. :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] :ivar ramp_up_start_time: Starting time for ramp up period. @@ -4261,6 +5991,8 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "name_properties_name": {"readonly": True}, "ramp_up_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, "ramp_up_capacity_threshold_pct": {"maximum": 100, "minimum": 1}, "ramp_down_minimum_hosts_pct": {"maximum": 100, "minimum": 0}, @@ -4271,6 +6003,8 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "name_properties_name": {"key": "properties.name", "type": "str"}, "days_of_week": {"key": "properties.daysOfWeek", "type": "[str]"}, "ramp_up_start_time": {"key": "properties.rampUpStartTime", "type": "Time"}, "ramp_up_load_balancing_algorithm": {"key": "properties.rampUpLoadBalancingAlgorithm", "type": "str"}, @@ -4361,6 +6095,7 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ super().__init__(**kwargs) + self.name_properties_name = None self.days_of_week = days_of_week self.ramp_up_start_time = ramp_up_start_time self.ramp_up_load_balancing_algorithm = ramp_up_load_balancing_algorithm @@ -4386,8 +6121,7 @@ class ScalingSchedule(_serialization.Model): # pylint: disable=too-many-instanc :ivar name: Name of the ScalingPlanPooledSchedule. :vartype name: str :ivar days_of_week: Set of days of the week on which this schedule is active. - :vartype days_of_week: list[str or - ~azure.mgmt.desktopvirtualization.models.ScalingScheduleDaysOfWeekItem] + :vartype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] :ivar ramp_up_start_time: Starting time for ramp up period. :vartype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :ivar ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Known @@ -4465,7 +6199,7 @@ def __init__( self, *, name: Optional[str] = None, - days_of_week: Optional[List[Union[str, "_models.ScalingScheduleDaysOfWeekItem"]]] = None, + days_of_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, ramp_up_start_time: Optional["_models.Time"] = None, ramp_up_load_balancing_algorithm: Optional[Union[str, "_models.SessionHostLoadBalancingAlgorithm"]] = None, ramp_up_minimum_hosts_pct: Optional[int] = None, @@ -4488,8 +6222,7 @@ def __init__( :keyword name: Name of the ScalingPlanPooledSchedule. :paramtype name: str :keyword days_of_week: Set of days of the week on which this schedule is active. - :paramtype days_of_week: list[str or - ~azure.mgmt.desktopvirtualization.models.ScalingScheduleDaysOfWeekItem] + :paramtype days_of_week: list[str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek] :keyword ramp_up_start_time: Starting time for ramp up period. :paramtype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time :keyword ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Known @@ -4556,6 +6289,88 @@ def __init__( self.off_peak_load_balancing_algorithm = off_peak_load_balancing_algorithm +class SecurityInfoPatchProperties(_serialization.Model): + """Security information. + + :ivar type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool + """ + super().__init__(**kwargs) + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + +class SecurityInfoProperties(_serialization.Model): + """Security information. + + :ivar type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool + """ + super().__init__(**kwargs) + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + class SendMessage(_serialization.Model): """Represents message sent to a UserSession. @@ -4609,15 +6424,16 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of SessionHost. (internal use). :vartype object_id: str @@ -4655,6 +6471,11 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes :vartype last_update_time: ~datetime.datetime :ivar update_error_message: The error message. :vartype update_error_message: str + :ivar last_session_host_update_time: The last time update was completed. + :vartype last_session_host_update_time: ~datetime.datetime + :ivar session_host_configuration: SessionHostConfiguration version reference at the time the + update is initiated, in the format of date time. Example: 2024-04-26T04:56:45Z. + :vartype session_host_configuration: str :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. :vartype session_host_health_check_results: list[~azure.mgmt.desktopvirtualization.models.SessionHostHealthCheckReport] @@ -4670,6 +6491,8 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "resource_id": {"readonly": True}, "status_timestamp": {"readonly": True}, "last_update_time": {"readonly": True}, + "last_session_host_update_time": {"readonly": True}, + "session_host_configuration": {"readonly": True}, "session_host_health_check_results": {"readonly": True}, } @@ -4694,6 +6517,8 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "update_state": {"key": "properties.updateState", "type": "str"}, "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, "update_error_message": {"key": "properties.updateErrorMessage", "type": "str"}, + "last_session_host_update_time": {"key": "properties.lastSessionHostUpdateTime", "type": "iso-8601"}, + "session_host_configuration": {"key": "properties.sessionHostConfiguration", "type": "str"}, "session_host_health_check_results": { "key": "properties.sessionHostHealthCheckResults", "type": "[SessionHostHealthCheckReport]", @@ -4745,7 +6570,6 @@ def __init__( :paramtype update_error_message: str """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.last_heart_beat = last_heart_beat self.sessions = sessions @@ -4755,14 +6579,374 @@ def __init__( self.resource_id = None self.assigned_user = assigned_user self.friendly_name = friendly_name - self.status = status - self.status_timestamp = None - self.os_version = os_version - self.sx_s_stack_version = sx_s_stack_version - self.update_state = update_state - self.last_update_time = None - self.update_error_message = update_error_message - self.session_host_health_check_results = None + self.status = status + self.status_timestamp = None + self.os_version = os_version + self.sx_s_stack_version = sx_s_stack_version + self.update_state = update_state + self.last_update_time = None + self.update_error_message = update_error_message + self.last_session_host_update_time = None + self.session_host_configuration = None + self.session_host_health_check_results = None + + +class SessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfiguration 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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar provisioning_state: Provisioning state of the Session Host Configuration. Known values + are: "Succeeded", "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.ProvisioningStateSHC + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "provisioning_state": {"readonly": True}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.version = None + self.friendly_name = friendly_name + self.provisioning_state = None + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class SessionHostConfigurationList(_serialization.Model): + """List of SessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostConfigurationPatch(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfigurationPatch definition. + + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoPatchProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. + :vartype vm_size_id: str + :ivar disk_info: Disk information. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :ivar domain_info: Domain configurations of session hosts. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties + """ + + _validation = { + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"max_length": 11}, + "custom_configuration_script_url": {"max_length": 260}, + } + + _attribute_map = { + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoPatchProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoPatchProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoPatchProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoPatchProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoPatchProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + "boot_diagnostics_info": { + "key": "properties.bootDiagnosticsInfo", + "type": "BootDiagnosticsInfoPatchProperties", + }, + } + + def __init__( + self, + *, + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + vm_name_prefix: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + network_info: Optional["_models.NetworkInfoPatchProperties"] = None, + vm_size_id: Optional[str] = None, + disk_info: Optional["_models.DiskInfoPatchProperties"] = None, + custom_configuration_script_url: Optional[str] = None, + image_info: Optional["_models.ImageInfoPatchProperties"] = None, + domain_info: Optional["_models.DomainInfoPatchProperties"] = None, + security_info: Optional["_models.SecurityInfoPatchProperties"] = None, + vm_admin_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoPatchProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :keyword domain_info: Domain configurations of session hosts. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties + """ + super().__init__(**kwargs) + self.friendly_name = friendly_name + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info class SessionHostHealthCheckFailureDetails(_serialization.Model): @@ -4870,19 +7054,322 @@ def __init__(self, *, value: Optional[List["_models.SessionHost"]] = None, **kwa self.next_link = None +class SessionHostManagement(ProxyResource): + """Represents a SessionHostManagement 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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. Required. + :vartype update: ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "scheduled_date_time_zone": {"required": True}, + "update": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationProperties"}, + } + + def __init__( + self, *, scheduled_date_time_zone: str, update: "_models.HostPoolUpdateConfigurationProperties", **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. Required. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementList(_serialization.Model): + """List of SessionHostManagement definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostManagement definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostManagement]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostManagement"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostManagement definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostManagementOperationProgress(_serialization.Model): + """SessionHostManagement Operation Progress information. + + :ivar execution_start_time: Time that the sessionHostManagement operation was created. + :vartype execution_start_time: ~datetime.datetime + :ivar total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :vartype total_session_hosts: int + :ivar session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :vartype session_hosts_in_progress: int + :ivar session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :vartype session_hosts_completed: int + :ivar session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :vartype session_hosts_rollback_failed: int + """ + + _attribute_map = { + "execution_start_time": {"key": "executionStartTime", "type": "iso-8601"}, + "total_session_hosts": {"key": "totalSessionHosts", "type": "int"}, + "session_hosts_in_progress": {"key": "sessionHostsInProgress", "type": "int"}, + "session_hosts_completed": {"key": "sessionHostsCompleted", "type": "int"}, + "session_hosts_rollback_failed": {"key": "sessionHostsRollbackFailed", "type": "int"}, + } + + def __init__( + self, + *, + execution_start_time: Optional[datetime.datetime] = None, + total_session_hosts: Optional[int] = None, + session_hosts_in_progress: Optional[int] = None, + session_hosts_completed: Optional[int] = None, + session_hosts_rollback_failed: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_start_time: Time that the sessionHostManagement operation was created. + :paramtype execution_start_time: ~datetime.datetime + :keyword total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :paramtype total_session_hosts: int + :keyword session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :paramtype session_hosts_in_progress: int + :keyword session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :paramtype session_hosts_completed: int + :keyword session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :paramtype session_hosts_rollback_failed: int + """ + super().__init__(**kwargs) + self.execution_start_time = execution_start_time + self.total_session_hosts = total_session_hosts + self.session_hosts_in_progress = session_hosts_in_progress + self.session_hosts_completed = session_hosts_completed + self.session_hosts_rollback_failed = session_hosts_rollback_failed + + +class SessionHostManagementPatch(_serialization.Model): + """Represents a SessionHostManagementPatch definition. + + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _attribute_map = { + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementUpdateStatus(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The current status of the session host update async operation. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Current defined values are < Error | Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | + Succeeded | Failed | Canceled. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :ivar correlation_id: The Log Analytics. + :vartype correlation_id: str + :ivar progress: Progress information on the sessionHostManagement operation. + :vartype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :ivar scheduled_date_time: The timestamp that the update is scheduled for. + :vartype scheduled_date_time: ~datetime.datetime + :ivar session_host_management: SessionHostManagement properties used for the operation. + :vartype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "error": {"key": "error", "type": "ErrorDetail"}, + "correlation_id": {"key": "properties.correlationId", "type": "str"}, + "progress": {"key": "properties.progress", "type": "SessionHostManagementOperationProgress"}, + "scheduled_date_time": {"key": "properties.scheduledDateTime", "type": "iso-8601"}, + "session_host_management": {"key": "properties.sessionHostManagement", "type": "SessionHostManagement"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + error: Optional["_models.ErrorDetail"] = None, + correlation_id: Optional[str] = None, + progress: Optional["_models.SessionHostManagementOperationProgress"] = None, + scheduled_date_time: Optional[datetime.datetime] = None, + session_host_management: Optional["_models.SessionHostManagement"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Current defined values are < Error | Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | + Succeeded | Failed | Canceled. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :keyword correlation_id: The Log Analytics. + :paramtype correlation_id: str + :keyword progress: Progress information on the sessionHostManagement operation. + :paramtype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :keyword scheduled_date_time: The timestamp that the update is scheduled for. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword session_host_management: SessionHostManagement properties used for the operation. + :paramtype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.error = error + self.correlation_id = correlation_id + self.progress = progress + self.scheduled_date_time = scheduled_date_time + self.session_host_management = session_host_management + + class SessionHostPatch(Resource): """SessionHost properties that can be patched. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar allow_new_session: Allow a new session. :vartype allow_new_session: bool :ivar assigned_user: User assigned to SessionHost. @@ -4895,12 +7382,14 @@ class SessionHostPatch(Resource): "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"}, "allow_new_session": {"key": "properties.allowNewSession", "type": "bool"}, "assigned_user": {"key": "properties.assignedUser", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -4928,19 +7417,91 @@ def __init__( self.friendly_name = friendly_name +class Sku(_serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "family": {"key": "family", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "_models.SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + class StartMenuItem(Resource): """Represents a StartMenuItem definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar app_alias: Alias of StartMenuItem. :vartype app_alias: str :ivar file_path: Path to the file of StartMenuItem. @@ -4957,12 +7518,14 @@ class StartMenuItem(Resource): "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"}, "app_alias": {"key": "properties.appAlias", "type": "str"}, "file_path": {"key": "properties.filePath", "type": "str"}, "command_line_arguments": {"key": "properties.commandLineArguments", "type": "str"}, @@ -5097,7 +7660,7 @@ def __init__( class Time(_serialization.Model): """The time for a scaling action to occur. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar hour: The hour. Required. :vartype hour: int @@ -5127,20 +7690,96 @@ def __init__(self, *, hour: int, minute: int, **kwargs: Any) -> None: self.minute = minute +class UpdateSessionHostsRequestBody(_serialization.Model): + """Object containing the definition for properties to be used for a sessionHostUpdate operation. + + :ivar scheduled_date_time: The timestamp that the update validation is scheduled for. If none + is provided, the update will be executed immediately. + :vartype scheduled_date_time: ~datetime.datetime + :ivar scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :vartype scheduled_date_time_zone: str + :ivar update: settings for management information for the hostpool update operation. If none is + provided the update will use the settings saved in the sessionHostManagement object. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + "scheduled_date_time_zone": {"key": "scheduledDateTimeZone", "type": "str"}, + "update": {"key": "update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time: Optional[datetime.datetime] = None, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time: The timestamp that the update validation is scheduled for. If + none is provided, the update will be executed immediately. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :paramtype scheduled_date_time_zone: str + :keyword update: settings for management information for the hostpool update operation. If none + is provided the update will use the settings saved in the sessionHostManagement object. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class UserSession(Resource): """Represents a UserSession definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: 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.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of user session. (internal use). :vartype object_id: str @@ -5204,7 +7843,6 @@ def __init__( :paramtype create_time: ~datetime.datetime """ super().__init__(**kwargs) - self.system_data = None self.object_id = None self.user_principal_name = user_principal_name self.application_type = application_type @@ -5248,15 +7886,22 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geo-location where the resource lives. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.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 managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete @@ -5264,7 +7909,7 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man managed by another resource. :vartype managed_by: str :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must @@ -5273,17 +7918,12 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: - :vartype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :ivar sku: - :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :ivar plan: - :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of Workspace. (internal use). :vartype object_id: str :ivar description: Description of Workspace. @@ -5309,9 +7949,10 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, - "system_data": {"readonly": True}, "object_id": {"readonly": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -5321,15 +7962,15 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "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"}, "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -5345,13 +7986,13 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man def __init__( self, *, - location: Optional[str] = None, + location: str, + tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, application_group_references: Optional[List[str]] = None, @@ -5359,7 +8000,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: The geo-location where the resource lives. + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, @@ -5367,19 +8010,15 @@ def __init__( it is managed by another resource. :paramtype managed_by: str :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. :paramtype kind: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: - :paramtype identity: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity - :keyword sku: - :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku - :keyword plan: - :paramtype plan: - ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword description: Description of Workspace. :paramtype description: str :keyword friendly_name: Friendly name of Workspace. @@ -5393,16 +8032,15 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess """ super().__init__( + tags=tags, location=location, managed_by=managed_by, kind=kind, - tags=tags, identity=identity, sku=sku, plan=plan, **kwargs ) - self.system_data = None self.object_id = None self.description = description self.friendly_name = friendly_name diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py index 975df17adf61..8ea21f89ab23 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py @@ -18,10 +18,19 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations +from ._app_attach_package_operations import AppAttachPackageOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -40,10 +49,19 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostConfigurationsOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", + "AppAttachPackageInfoOperations", "MsixImagesOperations", + "AppAttachPackageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..eddd5c6b5ab3 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,272 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, 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.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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_host_pool_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 ActiveSessionHostConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` 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, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :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.ActiveSessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ActiveSessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py new file mode 100644 index 000000000000..35d8d1034c76 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py @@ -0,0 +1,258 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, 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.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_import_method_request( + resource_group_name: str, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/importAppAttachPackageInfo", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 AppAttachPackageInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package_info` 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") + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: _models.ImportPackageInfoRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Required. + :type import_package_info_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def import_method( + self, + resource_group_name: str, + host_pool_name: str, + import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """Gets information from a package given the path to the package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param import_package_info_request: Object containing URI to package image and other optional + properties. Is either a ImportPackageInfoRequest type or a IO[bytes] type. Required. + :type import_package_info_request: + ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest or IO[bytes] + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(import_package_info_request, (IOBase, bytes)): + _content = import_package_info_request + else: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_import_method_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py new file mode 100644 index 000000000000..8fe66b8a0db8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py @@ -0,0 +1,843 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, 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.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, app_attach_package_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _url: str = _url.format(**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, app_attach_package_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", "2024-08-08-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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _url: str = _url.format(**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, + app_attach_package_name: str, + subscription_id: str, + *, + force: Optional[bool] = 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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # 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, app_attach_package_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", "2024-08-08-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.DesktopVirtualization/appAttachPackages/{appAttachPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appAttachPackageName": _SERIALIZER.url( + "app_attach_package_name", + app_attach_package_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$", + ), + } + + _url: str = _url.format(**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, *, filter: 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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # 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, *, filter: 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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppAttachPackageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`app_attach_package` 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, app_attach_package_name: str, **kwargs: Any) -> _models.AppAttachPackage: + """Get an app attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppAttachPackage] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: _models.AppAttachPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Required. + :type app_attach_package: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package: Union[_models.AppAttachPackage, IO[bytes]], + **kwargs: Any + ) -> _models.AppAttachPackage: + """Create or update an App Attach package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package: Object containing App Attach Package definitions. Is either a + AppAttachPackage type or a IO[bytes] type. Required. + :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage or + IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package, (IOBase, bytes)): + _content = app_attach_package + else: + _json = self._serialize.body(app_attach_package, "AppAttachPackage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + + deserialized = self._deserialize("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + force=force, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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, {}) # type: ignore + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[_models.AppAttachPackagePatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Default value + is None. + :type app_attach_package_patch: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_attach_package_name: str, + app_attach_package_patch: Optional[Union[_models.AppAttachPackagePatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.AppAttachPackage: + """Update an App Attach Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_attach_package_name: The name of the App Attach package arm object. Required. + :type app_attach_package_name: str + :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + AppAttachPackagePatch type or a IO[bytes] type. Default value is None. + :type app_attach_package_patch: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatch + or IO[bytes] + :return: AppAttachPackage or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.AppAttachPackage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(app_attach_package_patch, (IOBase, bytes)): + _content = app_attach_package_patch + else: + if app_attach_package_patch is not None: + _json = self._serialize.body(app_attach_package_patch, "AppAttachPackagePatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + app_attach_package_name=app_attach_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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("AppAttachPackage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, package owner name, and custom data. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) + + @distributed_trace + def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AppAttachPackage"]: + """List App Attach packages in subscription. + + :param filter: OData filter expression. Valid properties for filtering are package name, + resource group, host pool, package owner name, and custom data. Default value is None. + :type filter: str + :return: An iterator like instance of either AppAttachPackage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :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.AppAttachPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppAttachPackageList", 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) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py index e4da88807cbf..dfbd54cf9c87 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,12 +55,17 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -78,7 +86,7 @@ def build_create_or_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88,12 +96,17 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -116,7 +129,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,12 +138,17 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -151,7 +169,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,12 +179,17 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -196,7 +219,7 @@ def build_list_by_resource_group_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +228,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -236,7 +259,7 @@ def build_list_by_subscription_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +267,7 @@ def build_list_by_subscription_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -288,12 +311,11 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,21 +329,19 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,16 +350,12 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -363,7 +379,6 @@ def create_or_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: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +389,7 @@ def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: IO, + application_group: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,11 +402,10 @@ def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Required. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -402,7 +416,7 @@ def create_or_update( self, resource_group_name: str, application_group_name: str, - application_group: Union[_models.ApplicationGroup, IO], + application_group: Union[_models.ApplicationGroup, IO[bytes]], **kwargs: Any ) -> _models.ApplicationGroup: """Create or update an applicationGroup. @@ -413,17 +427,13 @@ def create_or_update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroup type or a IO type. Required. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup 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 + ApplicationGroup type or a IO[bytes] type. Required. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -446,7 +456,7 @@ def create_or_update( else: _json = self._serialize.body(application_group, "ApplicationGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -454,16 +464,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,21 +480,13 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ApplicationGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, **kwargs: Any @@ -498,12 +498,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,21 +516,19 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,11 +538,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -570,7 +563,6 @@ def 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: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -581,7 +573,7 @@ def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[IO] = None, + application_group: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -595,11 +587,10 @@ def update( :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Default value is None. - :type application_group: IO + :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -610,7 +601,7 @@ def update( self, resource_group_name: str, application_group_name: str, - application_group: Optional[Union[_models.ApplicationGroupPatch, IO]] = None, + application_group: Optional[Union[_models.ApplicationGroupPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ApplicationGroup: """Update an applicationGroup. @@ -621,17 +612,14 @@ def update( :param application_group_name: The name of the application group. Required. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. Is either a - ApplicationGroupPatch type or a IO type. Default value is None. - :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch 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 + ApplicationGroupPatch type or a IO[bytes] type. Default value is None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or + IO[bytes] :return: ApplicationGroup or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -657,7 +645,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -665,16 +653,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,16 +669,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApplicationGroup", pipeline_response) + deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -718,7 +700,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -729,7 +710,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -740,7 +721,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, filter=filter, @@ -748,12 +729,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -765,13 +744,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -781,11 +759,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,10 +775,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } - @distributed_trace def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ApplicationGroup"]: """List applicationGroups in subscription. @@ -808,7 +782,6 @@ def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> I :param filter: OData filter expression. Valid properties for filtering are applicationGroupType. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -819,7 +792,7 @@ def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> I api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,16 +803,14 @@ def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> I def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, filter=filter, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -851,13 +822,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationGroupList", pipeline_response) @@ -867,11 +837,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -882,7 +852,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py index 53337c7d544a..9571aeedcb8e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,14 +55,21 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,7 +89,7 @@ def build_create_or_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,14 +99,21 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -118,7 +135,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,14 +144,21 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -154,7 +178,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -164,14 +188,21 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "applicationName": _SERIALIZER.url( + "application_name", application_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "applicationName": _SERIALIZER.url("application_name", application_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -200,7 +231,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,12 +240,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -268,12 +304,11 @@ def get( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,22 +322,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -311,16 +344,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -348,7 +377,6 @@ def create_or_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: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -360,7 +388,7 @@ def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: IO, + application: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,11 +404,10 @@ def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Required. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -392,7 +419,7 @@ def create_or_update( resource_group_name: str, application_group_name: str, application_name: str, - application: Union[_models.Application, IO], + application: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> _models.Application: """Create or update an application. @@ -406,17 +433,13 @@ def create_or_update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a Application type or - a IO type. Required. - :type application: ~azure.mgmt.desktopvirtualization.models.Application 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 + a IO[bytes] type. Required. + :type application: ~azure.mgmt.desktopvirtualization.models.Application or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +462,7 @@ def create_or_update( else: _json = self._serialize.body(application, "Application") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -448,16 +471,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,21 +487,13 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -495,12 +508,11 @@ def delete( # pylint: disable=inconsistent-return-statements :param application_name: The name of the application within the specified application group. Required. :type application_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,22 +526,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,11 +549,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -571,7 +577,6 @@ def 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: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -583,7 +588,7 @@ def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[IO] = None, + application: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -599,11 +604,10 @@ def update( Required. :type application_name: str :param application: Object containing Application definitions. Default value is None. - :type application: IO + :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: @@ -615,7 +619,7 @@ def update( resource_group_name: str, application_group_name: str, application_name: str, - application: Optional[Union[_models.ApplicationPatch, IO]] = None, + application: Optional[Union[_models.ApplicationPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Application: """Update an application. @@ -629,17 +633,13 @@ def update( Required. :type application_name: str :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO type. Default value is None. - :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch 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 + type or a IO[bytes] type. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch or IO[bytes] :return: Application or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +665,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, application_name=application_name, @@ -674,16 +674,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,16 +690,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -726,7 +720,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Application] :raises ~azure.core.exceptions.HttpResponseError: @@ -737,7 +730,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -748,7 +741,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -756,12 +749,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -773,13 +764,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationList", pipeline_response) @@ -789,11 +779,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,7 +794,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..c39df38befae --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py @@ -0,0 +1,296 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` 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 _post_initial( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(host_pool_update_control_parameter, (IOBase, bytes)): + _content = host_pool_update_control_parameter + else: + _json = self._serialize.body(host_pool_update_control_parameter, "HostPoolUpdateControlParameter") + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: _models.HostPoolUpdateControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Is either a HostPoolUpdateControlParameter type or a IO[bytes] type. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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._post_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_update_control_parameter=host_pool_update_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py index 6da4588b4dc1..77fe7bf2af2b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,14 +55,21 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "desktopName": _SERIALIZER.url( + "desktop_name", desktop_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "desktopName": _SERIALIZER.url("desktop_name", desktop_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,7 +89,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,14 +99,21 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", + ), + "desktopName": _SERIALIZER.url( + "desktop_name", desktop_name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "desktopName": _SERIALIZER.url("desktop_name", desktop_name, "str", max_length=24, min_length=3), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -125,7 +142,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,12 +151,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -192,12 +214,11 @@ def get( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,22 +232,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Desktop] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,16 +254,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Desktop", pipeline_response) + deserialized = self._deserialize("Desktop", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @overload def update( @@ -271,7 +286,6 @@ def 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: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -283,7 +297,7 @@ def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[IO] = None, + desktop: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -298,11 +312,10 @@ def update( :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str :param desktop: Object containing Desktop definitions. Default value is None. - :type desktop: IO + :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: @@ -314,7 +327,7 @@ def update( resource_group_name: str, application_group_name: str, desktop_name: str, - desktop: Optional[Union[_models.DesktopPatch, IO]] = None, + desktop: Optional[Union[_models.DesktopPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Desktop: """Update a desktop. @@ -326,18 +339,14 @@ def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. Required. :type desktop_name: str - :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a IO - type. Default value is None. - :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch 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 + :param desktop: Object containing Desktop definitions. Is either a DesktopPatch type or a + IO[bytes] type. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch or IO[bytes] :return: Desktop or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +372,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, application_group_name=application_group_name, desktop_name=desktop_name, @@ -372,16 +381,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -390,16 +397,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Desktop", pipeline_response) + deserialized = self._deserialize("Desktop", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -424,7 +427,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Desktop or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Desktop] :raises ~azure.core.exceptions.HttpResponseError: @@ -435,7 +437,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DesktopList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -446,7 +448,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -454,12 +456,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -471,13 +471,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DesktopList", pipeline_response) @@ -487,11 +486,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,7 +501,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py index a9a810f4e963..2637dee07fea 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +55,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +81,7 @@ def build_create_or_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +91,13 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +119,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +128,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -147,7 +156,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -157,11 +166,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -189,7 +200,7 @@ def build_list_by_resource_group_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +209,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -232,7 +243,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +251,7 @@ def build_list_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -260,13 +271,13 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_retrieve_registration_token_request( +def build_retrieve_registration_token_request( # pylint: disable=name-too-long resource_group_name: str, host_pool_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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,11 +286,48 @@ def build_retrieve_registration_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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_registration_tokens_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/listRegistrationTokens", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -321,12 +369,11 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,21 +387,19 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPool] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -363,16 +408,12 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -396,7 +437,6 @@ def create_or_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: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +447,7 @@ def create_or_update( self, resource_group_name: str, host_pool_name: str, - host_pool: IO, + host_pool: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -420,11 +460,10 @@ def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Required. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -432,7 +471,11 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, host_pool_name: str, host_pool: Union[_models.HostPool, IO], **kwargs: Any + self, + resource_group_name: str, + host_pool_name: str, + host_pool: Union[_models.HostPool, IO[bytes]], + **kwargs: Any ) -> _models.HostPool: """Create or update a host pool. @@ -441,18 +484,14 @@ def create_or_update( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a IO - type. Required. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool 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 + :param host_pool: Object containing HostPool definitions. Is either a HostPool type or a + IO[bytes] type. Required. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -475,7 +514,7 @@ def create_or_update( else: _json = self._serialize.body(host_pool, "HostPool") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -483,16 +522,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,21 +538,13 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("HostPool", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any @@ -529,12 +558,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type host_pool_name: str :param force: Force flag to delete sessionHost. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,22 +576,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,11 +599,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -601,7 +623,6 @@ def 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: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -612,7 +633,7 @@ def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[IO] = None, + host_pool: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -625,11 +646,10 @@ def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Default value is None. - :type host_pool: IO + :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: @@ -640,7 +660,7 @@ def update( self, resource_group_name: str, host_pool_name: str, - host_pool: Optional[Union[_models.HostPoolPatch, IO]] = None, + host_pool: Optional[Union[_models.HostPoolPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.HostPool: """Update a host pool. @@ -651,17 +671,13 @@ def update( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. Is either a HostPoolPatch type or a - IO type. Default value is None. - :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch 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 + IO[bytes] type. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch or IO[bytes] :return: HostPool or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -687,7 +703,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -695,16 +711,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -713,16 +727,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostPool", pipeline_response) + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -744,7 +754,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] :raises ~azure.core.exceptions.HttpResponseError: @@ -755,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -766,19 +775,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -790,13 +797,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -806,11 +812,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -822,10 +828,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools" - } - @distributed_trace def list( self, @@ -842,7 +844,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPool or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] :raises ~azure.core.exceptions.HttpResponseError: @@ -853,7 +854,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -864,18 +865,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -887,13 +886,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("HostPoolList", pipeline_response) @@ -903,11 +901,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,8 +917,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} - @distributed_trace def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any @@ -932,12 +928,11 @@ def retrieve_registration_token( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -951,21 +946,19 @@ def retrieve_registration_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - request = build_retrieve_registration_token_request( + _request = build_retrieve_registration_token_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_registration_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,13 +967,66 @@ def retrieve_registration_token( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationInfo", pipeline_response) + deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - retrieve_registration_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken" - } + @distributed_trace + def list_registration_tokens( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.RegistrationTokenList: + """Operation to list the RegistrationTokens associated with the HostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: RegistrationTokenList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationTokenList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RegistrationTokenList] = kwargs.pop("cls", None) + + _request = build_list_registration_tokens_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..48fe1026d8e5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,231 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` 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") + + @overload + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO[bytes] type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py index 452128147281..eb46a11d44bb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_expand_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,11 +56,13 @@ def build_expand_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -114,7 +119,6 @@ def expand( :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: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -125,7 +129,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO, + msix_image_uri: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -138,11 +142,10 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Required. - :type msix_image_uri: IO + :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -153,7 +156,7 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO], + msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], **kwargs: Any ) -> Iterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. @@ -164,12 +167,8 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. Required. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO type. Required. - :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI 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 + IO[bytes] type. Required. + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI or IO[bytes] :return: An iterator like instance of either ExpandMsixImage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :raises ~azure.core.exceptions.HttpResponseError: @@ -181,7 +180,7 @@ def expand( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ExpandMsixImageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +198,7 @@ def expand( def prepare_request(next_link=None): if not next_link: - request = build_expand_request( + _request = build_expand_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -207,12 +206,10 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.expand.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -224,13 +221,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) @@ -240,11 +236,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,7 +251,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - expand.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py index 3ad5108dc6ec..4031a1d53f03 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,13 +55,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -79,7 +89,7 @@ def build_create_or_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,13 +99,20 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -118,7 +135,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,13 +144,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -154,7 +178,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -164,13 +188,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", msix_package_full_name, "str", max_length=100, min_length=3 + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + min_length=3, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -200,7 +231,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,11 +240,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -266,12 +299,11 @@ def get( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -285,22 +317,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,16 +339,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -346,7 +372,6 @@ def create_or_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: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +383,7 @@ def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: IO, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -374,11 +399,10 @@ def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Required. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -390,7 +414,7 @@ def create_or_update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Union[_models.MSIXPackage, IO], + msix_package: Union[_models.MSIXPackage, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Create or update a MSIX package. @@ -404,17 +428,13 @@ def create_or_update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackage type - or a IO type. Required. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage 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 + or a IO[bytes] type. Required. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +457,7 @@ def create_or_update( else: _json = self._serialize.body(msix_package, "MSIXPackage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -446,16 +466,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,21 +482,13 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MSIXPackage", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -493,12 +503,11 @@ def delete( # pylint: disable=inconsistent-return-statements :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. Required. :type msix_package_full_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,22 +521,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,11 +544,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -569,7 +572,6 @@ def 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: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -581,7 +583,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO] = None, + msix_package: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -597,11 +599,10 @@ def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Default value is None. - :type msix_package: IO + :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: @@ -613,7 +614,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO]] = None, + msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -627,17 +628,13 @@ def update( within specified hostpool. Required. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO type. Default value is None. - :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch 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 + type or a IO[bytes] type. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch or IO[bytes] :return: MSIXPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -663,7 +660,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, msix_package_full_name=msix_package_full_name, @@ -672,16 +669,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,16 +685,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSIXPackage", pipeline_response) + deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -724,7 +715,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackage] :raises ~azure.core.exceptions.HttpResponseError: @@ -735,7 +725,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MSIXPackageList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +736,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -754,12 +744,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -771,13 +759,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("MSIXPackageList", pipeline_response) @@ -787,11 +774,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -802,7 +789,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py index daa03136702e..86d80a185826 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +81,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: """List all of the available operations the Desktop Virtualization resource provider supports. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) :rtype: @@ -91,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -121,13 +121,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) @@ -137,11 +136,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,5 +151,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.DesktopVirtualization/operations"} diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py index b6462f385c36..ab31ba1f9e0f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_list_by_workspace_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +55,13 @@ def build_list_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -80,7 +85,7 @@ def build_get_by_workspace_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,11 +94,13 @@ def build_get_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -120,7 +127,7 @@ def build_delete_by_workspace_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,11 +136,13 @@ def build_delete_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -160,7 +169,7 @@ def build_update_by_workspace_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,11 +179,13 @@ def build_update_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -206,7 +217,7 @@ def build_list_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,11 +226,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -249,7 +262,7 @@ def build_get_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -258,11 +271,13 @@ def build_get_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -289,7 +304,7 @@ def build_delete_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,11 +313,13 @@ def build_delete_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -329,7 +346,7 @@ def build_update_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -339,11 +356,13 @@ def build_update_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -392,7 +411,6 @@ def list_by_workspace( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -405,7 +423,7 @@ def list_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResultWithSystemData] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -416,17 +434,15 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -438,13 +454,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -454,11 +469,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,10 +485,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections" - } - @distributed_trace def get_by_workspace( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -488,12 +499,11 @@ def get_by_workspace( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,22 +517,20 @@ def get_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_workspace_request( + _request = build_get_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -531,16 +539,12 @@ def get_by_workspace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def delete_by_workspace( # pylint: disable=inconsistent-return-statements @@ -556,12 +560,11 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,22 +578,20 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements 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_by_workspace_request( + _request = build_delete_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,11 +601,7 @@ def delete_by_workspace( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update_by_workspace( @@ -632,7 +629,6 @@ def update_by_workspace( :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: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -644,7 +640,7 @@ def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -660,11 +656,10 @@ def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -676,7 +671,7 @@ def update_by_workspace( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -690,17 +685,14 @@ def update_by_workspace( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection 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 + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -723,7 +715,7 @@ def update_by_workspace( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_workspace_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -732,16 +724,14 @@ def update_by_workspace( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -750,16 +740,12 @@ def update_by_workspace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_host_pool( @@ -784,7 +770,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -797,7 +782,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResultWithSystemData] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -808,7 +793,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -816,12 +801,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -833,13 +816,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) @@ -849,11 +831,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -865,10 +847,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections" - } - @distributed_trace def get_by_host_pool( self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -883,12 +861,11 @@ def get_by_host_pool( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -902,22 +879,20 @@ def get_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionWithSystemData] = kwargs.pop("cls", None) - request = build_get_by_host_pool_request( + _request = build_get_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,16 +901,12 @@ def get_by_host_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def delete_by_host_pool( # pylint: disable=inconsistent-return-statements @@ -951,12 +922,11 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -970,22 +940,20 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements 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_by_host_pool_request( + _request = build_delete_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -995,11 +963,7 @@ def delete_by_host_pool( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update_by_host_pool( @@ -1027,7 +991,6 @@ def update_by_host_pool( :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: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -1039,7 +1002,7 @@ def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: IO, + connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1055,11 +1018,10 @@ def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Required. - :type connection: IO + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: @@ -1071,7 +1033,7 @@ def update_by_host_pool( resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO], + connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: """Approve or reject a private endpoint connection. @@ -1085,17 +1047,14 @@ def update_by_host_pool( with the Azure resource. Required. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection 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 + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or + IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1118,7 +1077,7 @@ def update_by_host_pool( else: _json = self._serialize.body(connection, "PrivateEndpointConnection") - request = build_update_by_host_pool_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -1127,16 +1086,14 @@ def update_by_host_pool( content_type=content_type, json=_json, content=_content, - template_url=self.update_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1145,13 +1102,9 @@ def update_by_host_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py index 7bbc918fb94c..d77e7dae6b87 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +52,7 @@ def build_list_by_workspace_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,11 +61,13 @@ def build_list_by_workspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -95,7 +100,7 @@ def build_list_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,11 +109,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -170,7 +177,6 @@ def list_by_workspace( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -182,7 +188,7 @@ def list_by_workspace( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +199,7 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - request = build_list_by_workspace_request( + _request = build_list_by_workspace_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -201,12 +207,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -218,13 +222,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -234,11 +237,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,10 +253,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources" - } - @distributed_trace def list_by_host_pool( self, @@ -277,7 +276,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] @@ -289,7 +287,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +298,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -308,12 +306,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -325,13 +321,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -341,11 +336,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,7 +351,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py index d4d7d34d218c..f7e928e95cea 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +50,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,13 +59,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -87,7 +97,7 @@ def build_create_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,13 +107,20 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -130,7 +147,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,13 +156,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -170,7 +194,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,13 +204,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -216,7 +247,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,11 +256,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -281,12 +314,11 @@ def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,22 +332,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,16 +354,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload def create( @@ -362,7 +388,6 @@ def create( :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: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +399,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -390,11 +415,10 @@ def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +430,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPersonalSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Create or update a ScalingPlanPersonalSchedule. @@ -419,18 +443,14 @@ def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedule type or a IO type. Required. + either a ScalingPlanPersonalSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -453,7 +473,7 @@ def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -462,16 +482,14 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,21 +498,13 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -508,12 +518,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,22 +536,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,11 +559,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -585,7 +588,6 @@ def 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: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -597,7 +599,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -613,11 +615,10 @@ def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -629,7 +630,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -642,18 +643,14 @@ def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPersonalSchedule definitions. Is - either a ScalingPlanPersonalSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch or IO[bytes] :return: ScalingPlanPersonalSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +676,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -688,16 +685,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,16 +701,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -740,7 +731,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of cls(response) :rtype: @@ -753,7 +743,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -764,7 +754,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -772,12 +762,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -789,13 +777,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPersonalScheduleList", pipeline_response) @@ -805,11 +792,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,7 +807,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py index f735b49cea2f..b559bb1b7cdb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +50,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,13 +59,20 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -87,7 +97,7 @@ def build_create_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -97,13 +107,20 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -130,7 +147,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,13 +156,20 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -170,7 +194,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,13 +204,20 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", scaling_plan_schedule_name, "str", max_length=64, min_length=1 + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -216,7 +247,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,11 +256,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -281,12 +314,11 @@ def get( :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,22 +332,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledSchedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,16 +354,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @overload def create( @@ -361,7 +387,6 @@ def create( :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: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -373,7 +398,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: IO, + scaling_plan_schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -389,11 +414,10 @@ def create( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Required. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +429,7 @@ def create( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO], + scaling_plan_schedule: Union[_models.ScalingPlanPooledSchedule, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Create or update a ScalingPlanPooledSchedule. @@ -418,18 +442,14 @@ def create( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedule type or a IO type. Required. + either a ScalingPlanPooledSchedule type or a IO[bytes] type. Required. :type scaling_plan_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule - 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 + or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +472,7 @@ def create( else: _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedule") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -461,16 +481,14 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,21 +497,13 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -507,12 +517,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type scaling_plan_name: str :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,22 +535,20 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,11 +558,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -584,7 +587,6 @@ def 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: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -596,7 +598,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO] = None, + scaling_plan_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -612,11 +614,10 @@ def update( :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Default value is None. - :type scaling_plan_schedule: IO + :type scaling_plan_schedule: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -628,7 +629,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO]] = None, + scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -641,18 +642,14 @@ def update( :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. :type scaling_plan_schedule_name: str :param scaling_plan_schedule: Object containing ScalingPlanPooledSchedule definitions. Is - either a ScalingPlanPooledSchedulePatch type or a IO type. Default value is None. + either a ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. :type scaling_plan_schedule: - ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch 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 + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch or IO[bytes] :return: ScalingPlanPooledSchedule or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,7 +675,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, scaling_plan_schedule_name=scaling_plan_schedule_name, @@ -687,16 +684,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -705,16 +700,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response) + deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -739,7 +730,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of cls(response) :rtype: @@ -752,7 +742,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -763,7 +753,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -771,12 +761,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -788,13 +776,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanPooledScheduleList", pipeline_response) @@ -804,11 +791,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -819,7 +806,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py index ae34ecab6c2f..e007dca2c251 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +55,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +81,7 @@ def build_create_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +91,13 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +119,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +128,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -145,7 +154,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,11 +164,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3), + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -187,7 +198,7 @@ def build_list_by_resource_group_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +207,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -230,7 +241,7 @@ def build_list_by_subscription_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +249,7 @@ def build_list_by_subscription_request( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -271,7 +282,7 @@ def build_list_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,11 +291,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -332,12 +345,11 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,21 +363,19 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,16 +384,12 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @overload def create( @@ -407,7 +413,6 @@ def create( :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: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -418,7 +423,7 @@ def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: IO, + scaling_plan: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -431,11 +436,10 @@ def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Required. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -446,7 +450,7 @@ def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Union[_models.ScalingPlan, IO], + scaling_plan: Union[_models.ScalingPlan, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlan: """Create or update a scaling plan. @@ -457,17 +461,13 @@ def create( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlan type - or a IO type. Required. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan 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 + or a IO[bytes] type. Required. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +490,7 @@ def create( else: _json = self._serialize.body(scaling_plan, "ScalingPlan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -498,16 +498,14 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,21 +514,13 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ScalingPlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any @@ -542,12 +532,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,21 +550,19 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,11 +572,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -613,7 +596,6 @@ def 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: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -624,7 +606,7 @@ def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[IO] = None, + scaling_plan: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -637,11 +619,10 @@ def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Default value is None. - :type scaling_plan: IO + :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: @@ -652,7 +633,7 @@ def update( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO]] = None, + scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlan: """Update a scaling plan. @@ -663,17 +644,13 @@ def update( :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlanPatch - type or a IO type. Default value is None. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch 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 + type or a IO[bytes] type. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO[bytes] :return: ScalingPlan or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +676,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -707,16 +684,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,16 +700,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScalingPlan", pipeline_response) + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -756,7 +727,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -767,7 +737,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,19 +748,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -802,13 +770,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -818,11 +785,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,10 +801,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_subscription( self, @@ -854,7 +817,6 @@ def list_by_subscription( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -865,7 +827,7 @@ def list_by_subscription( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -876,18 +838,16 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -899,13 +859,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -915,11 +874,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -931,10 +890,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" - } - @distributed_trace def list_by_host_pool( self, @@ -958,7 +913,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :raises ~azure.core.exceptions.HttpResponseError: @@ -969,7 +923,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -980,7 +934,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -988,12 +942,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1005,13 +957,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScalingPlanList", pipeline_response) @@ -1021,11 +972,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +987,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..044f2b37fd29 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py @@ -0,0 +1,787 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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_get_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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_host_pool_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` 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, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO[bytes] type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration or IO[bytes] + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + 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[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO[bytes] type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch or IO[bytes] + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfiguration] = 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, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + 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[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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.SessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..a187d704b94a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py @@ -0,0 +1,614 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, 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.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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, host_pool_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", "2024-08-08-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.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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_host_pool_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` 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, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO[bytes]], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO[bytes] type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO[bytes] type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :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.SessionHostManagementList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementList", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..01c50d5e31ea --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 SessionHostManagementsUpdateStatusOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_update_status` 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, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostManagementUpdateStatus: + """Get the session host update status for a given hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagementUpdateStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementUpdateStatus] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagementUpdateStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py new file mode 100644 index 000000000000..39329912ef32 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_retry_provisioning_request( + resource_group_name: str, host_pool_name: str, session_host_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", "2024-08-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**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 SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` 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 retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py index 231e01d95a33..d991bb3ebaf5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,12 +55,16 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -83,7 +90,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,12 +99,16 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -125,7 +136,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,12 +146,16 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -166,12 +181,13 @@ def build_list_request( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: 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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,11 +196,13 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -197,6 +215,10 @@ def build_list_request( _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") if initial_skip is not None: _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") + if vm_path is not None: + _params["vmPath"] = _SERIALIZER.query( + "vm_path", vm_path, "str", max_length=1092, min_length=3, pattern=r"^[A-Z][a-z][0-9][@./-_ ]*$" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -237,12 +259,11 @@ def get( :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,22 +277,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,16 +299,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SessionHost", pipeline_response) + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -313,12 +328,11 @@ def delete( # pylint: disable=inconsistent-return-statements :param force: Force flag to force sessionHost deletion even when userSession exists. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,23 +346,21 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,11 +370,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -394,7 +402,6 @@ def 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: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +414,7 @@ def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[IO] = None, + session_host: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -426,11 +433,10 @@ def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Default value is None. - :type session_host: IO + :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: @@ -443,7 +449,7 @@ def update( host_pool_name: str, session_host_name: str, force: Optional[bool] = None, - session_host: Optional[Union[_models.SessionHostPatch, IO]] = None, + session_host: Optional[Union[_models.SessionHostPatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.SessionHost: """Update a session host. @@ -460,17 +466,13 @@ def update( is None. :type force: bool :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO type. Default value is None. - :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch 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 + type or a IO[bytes] type. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch or IO[bytes] :return: SessionHost or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +498,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -506,16 +508,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,16 +524,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SessionHost", pipeline_response) + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -543,6 +539,7 @@ def list( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.SessionHost"]: """List sessionHosts. @@ -558,7 +555,8 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response + :param vm_path: The path to the VM. Default value is None. + :type vm_path: str :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] :raises ~azure.core.exceptions.HttpResponseError: @@ -569,7 +567,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SessionHostList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,20 +578,19 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, + vm_path=vm_path, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -605,13 +602,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SessionHostList", pipeline_response) @@ -621,11 +617,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -636,7 +632,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py index a17065ac2cdc..655570ad3806 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +52,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,12 +61,17 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "applicationGroupName": _SERIALIZER.url( - "application_group_name", application_group_name, "str", max_length=64, min_length=3 + "application_group_name", + application_group_name, + "str", + max_length=255, + min_length=1, + pattern=r"^[A-Za-z0-9@.\-_ ]*$", ), } @@ -126,7 +134,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItem or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItem] :raises ~azure.core.exceptions.HttpResponseError: @@ -137,7 +144,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StartMenuItemList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +155,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, application_group_name=application_group_name, subscription_id=self._config.subscription_id, @@ -156,12 +163,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -173,13 +178,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StartMenuItemList", pipeline_response) @@ -189,11 +193,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,7 +208,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py index ba3683afd05d..23089fcacabf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +54,7 @@ def build_list_by_host_pool_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,11 +63,13 @@ def build_list_by_host_pool_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -97,7 +102,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,12 +111,16 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -139,7 +148,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,12 +157,16 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -184,7 +197,7 @@ def build_list_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,12 +206,16 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -229,7 +246,7 @@ def build_disconnect_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,12 +255,16 @@ def build_disconnect_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -269,7 +290,7 @@ def build_send_message_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -279,12 +300,16 @@ def build_send_message_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, "str", max_length=64, min_length=3), - "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, "str", max_length=48, min_length=3), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, "str", max_length=24, min_length=1), } @@ -347,7 +372,6 @@ def list_by_host_pool( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +382,7 @@ def list_by_host_pool( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSessionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +393,7 @@ def list_by_host_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_host_pool_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -378,12 +402,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, api_version=api_version, - template_url=self.list_by_host_pool.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -395,13 +417,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -411,11 +432,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,10 +448,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_host_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions" - } - @distributed_trace def get( self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -448,12 +465,11 @@ def get( :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,23 +483,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSession] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -492,16 +506,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UserSession", pipeline_response) + deserialized = self._deserialize("UserSession", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -528,12 +538,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param force: Force flag to login off userSession. Default value is None. :type force: bool - :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,7 +556,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -555,16 +564,14 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, force=force, 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,11 +581,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list( @@ -607,7 +610,6 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSession or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSession] :raises ~azure.core.exceptions.HttpResponseError: @@ -618,7 +620,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UserSessionList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +631,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -638,12 +640,10 @@ def prepare_request(next_link=None): is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -655,13 +655,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("UserSessionList", pipeline_response) @@ -671,11 +670,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -687,10 +686,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions" - } - @distributed_trace def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any @@ -708,12 +703,11 @@ def disconnect( # pylint: disable=inconsistent-return-statements :param user_session_id: The name of the user session within the specified session host. Required. :type user_session_id: 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -727,23 +721,21 @@ def disconnect( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_disconnect_request( + _request = build_disconnect_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, user_session_id=user_session_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.disconnect.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,11 +745,7 @@ def disconnect( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - disconnect.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def send_message( # pylint: disable=inconsistent-return-statements @@ -790,7 +778,6 @@ def send_message( # pylint: disable=inconsistent-return-statements :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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -803,7 +790,7 @@ def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[IO] = None, + send_message: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -823,11 +810,10 @@ def send_message( # pylint: disable=inconsistent-return-statements :type user_session_id: str :param send_message: Object containing message includes title and message body. Default value is None. - :type send_message: IO + :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword 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: @@ -840,7 +826,7 @@ def send_message( # pylint: disable=inconsistent-return-statements host_pool_name: str, session_host_name: str, user_session_id: str, - send_message: Optional[Union[_models.SendMessage, IO]] = None, + send_message: Optional[Union[_models.SendMessage, IO[bytes]]] = None, **kwargs: Any ) -> None: """Send a message to a user. @@ -857,17 +843,13 @@ def send_message( # pylint: disable=inconsistent-return-statements Required. :type user_session_id: str :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO type. Default value is None. - :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage 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 + SendMessage type or a IO[bytes] type. Default value is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +875,7 @@ def send_message( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_send_message_request( + _request = build_send_message_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, session_host_name=session_host_name, @@ -903,16 +885,14 @@ def send_message( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.send_message.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,8 +902,4 @@ def send_message( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - send_message.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py index 8419c3184b09..2f2a9e2cab7d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) 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.rest import HttpRequest, HttpResponse 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 +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_get_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +55,13 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -76,7 +81,7 @@ def build_create_or_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,11 +91,13 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -112,7 +119,7 @@ def build_delete_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,11 +128,13 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -145,7 +154,7 @@ def build_update_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,11 +164,13 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str", max_length=64, min_length=3), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=255, min_length=1, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -187,7 +198,7 @@ def build_list_by_resource_group_request( _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-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +207,7 @@ def build_list_by_resource_group_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -223,7 +234,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-05")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +242,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -273,12 +284,11 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,21 +302,19 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,16 +323,12 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -348,7 +352,6 @@ def create_or_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: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -359,7 +362,7 @@ def create_or_update( self, resource_group_name: str, workspace_name: str, - workspace: IO, + workspace: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -372,11 +375,10 @@ def create_or_update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Required. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -384,7 +386,11 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, workspace_name: str, workspace: Union[_models.Workspace, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + workspace: Union[_models.Workspace, IO[bytes]], + **kwargs: Any ) -> _models.Workspace: """Create or update a workspace. @@ -393,18 +399,14 @@ def create_or_update( :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_name: str - :param workspace: Object containing Workspace definitions. Is either a Workspace type or a IO - type. Required. - :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace 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 + :param workspace: Object containing Workspace definitions. Is either a Workspace type or a + IO[bytes] type. Required. + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +429,7 @@ def create_or_update( else: _json = self._serialize.body(workspace, "Workspace") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -435,16 +437,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -453,21 +453,13 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any @@ -479,12 +471,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param workspace_name: The name of the workspace. Required. :type workspace_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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,21 +489,19 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,11 +511,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -550,7 +535,6 @@ def 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: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +545,7 @@ def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[IO] = None, + workspace: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -574,11 +558,10 @@ def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Default value is None. - :type workspace: IO + :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: @@ -589,7 +572,7 @@ def update( self, resource_group_name: str, workspace_name: str, - workspace: Optional[Union[_models.WorkspacePatch, IO]] = None, + workspace: Optional[Union[_models.WorkspacePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.Workspace: """Update a workspace. @@ -600,17 +583,13 @@ def update( :param workspace_name: The name of the workspace. Required. :type workspace_name: str :param workspace: Object containing Workspace definitions. Is either a WorkspacePatch type or a - IO type. Default value is None. - :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch 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 + IO[bytes] type. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch or IO[bytes] :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +615,7 @@ def update( else: _json = None - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -644,16 +623,14 @@ def update( 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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -662,16 +639,12 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -693,7 +666,6 @@ def list_by_resource_group( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -704,7 +676,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -715,19 +687,17 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -739,13 +709,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -755,11 +724,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,15 +740,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: """List workspaces in subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Workspace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -790,7 +754,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -801,15 +765,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -821,13 +783,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WorkspaceList", pipeline_response) @@ -837,11 +798,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -852,7 +813,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" - } diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py new file mode 100644 index 000000000000..bcb6bb76cefa --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ActiveSessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..e6aeb970b31e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py @@ -0,0 +1,43 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ActiveSessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py new file mode 100644 index 000000000000..ecbc50080132 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py @@ -0,0 +1,85 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_create.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.create_or_update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + app_attach_package={ + "location": "southcentralus", + "properties": { + "customData": "", + "failHealthCheckOnStagingFailure": "NeedsAssistance", + "hostPoolReferences": [], + "image": { + "certificateExpiry": "2023-01-02T17:18:19.1234567Z", + "certificateName": "certName", + "displayName": "displayname", + "imagePath": "imagepath", + "isActive": False, + "isRegularRegistration": False, + "lastUpdated": "2008-09-22T14:01:54.9571247Z", + "packageAlias": "msixpackagealias", + "packageApplications": [ + { + "appId": "AppId", + "appUserModelID": "AppUserModelId", + "description": "PackageApplicationDescription", + "friendlyName": "FriendlyName", + "iconImageName": "Iconimagename", + "rawIcon": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + "rawPng": "VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo", + } + ], + "packageDependencies": [ + { + "dependencyName": "MsixPackage_Dependency_Name", + "minVersion": "packageDep_version", + "publisher": "MsixPackage_Dependency_Publisher", + } + ], + "packageFamilyName": "MsixPackage_FamilyName", + "packageFullName": "MsixPackage_FullName", + "packageName": "MsixPackageName", + "packageRelativePath": "packagerelativepath", + "version": "packageversion", + }, + "keyVaultURL": "", + "packageOwnerName": "App Attach", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py new file mode 100644 index 000000000000..818145419468 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py @@ -0,0 +1,41 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_delete.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.app_attach_package.delete( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py new file mode 100644 index 000000000000..cb030ccb331d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.get( + resource_group_name="resourceGroup1", + app_attach_package_name="packagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py new file mode 100644 index 000000000000..63f1e79e3c1a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_info_import_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package_info.import_method( + resource_group_name="resourceGroup1", + host_pool_name="hostpool1", + import_package_info_request={"packageArchitecture": "x64", "path": "imagepath"}, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackageInfo_Import_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py similarity index 84% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py index 4327c7d44dfe..74937e2fd0d5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_image_expand_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_image_expand_post.py + python app_attach_package_list_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, @@ -29,15 +30,13 @@ def main(): subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", ) - response = client.msix_images.expand( + response = client.app_attach_package.list_by_resource_group( resource_group_name="resourceGroup1", - host_pool_name="hostpool1", - msix_image_uri={"uri": "imagepath"}, ) for item in response: print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixImage_Expand_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py new file mode 100644 index 000000000000..427430ace695 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py @@ -0,0 +1,40 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_list_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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py new file mode 100644 index 000000000000..473e11c8a2d0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python app_attach_package_update.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.app_attach_package.update( + resource_group_name="resourceGroup1", + app_attach_package_name="msixpackagefullname", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py index df2e652513a2..7444245f60f2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Application_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py index a2e10c776409..75c9d725503e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Application_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py index be2a3c46c31b..75bea3960277 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Application_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py index 080eea544cde..4ac54744387f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py index 918ac61d8d8a..c4ac28cb30dc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py index d6e7f3238c77..18e9019c88a1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py index 9f8854070fbc..799945282f88 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py index 9c8e6f484815..db6cb8f4316b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py index ae3b69e90abc..8343e174b56b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ApplicationGroup_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroup_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py index 2a069dded7b5..49c8aa6762ad 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Application_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py index 2543ab83cc46..b4f95abcce32 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Application_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Application_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py index 6e434cde2579..1ba375031356 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktop_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py index fbb4fc16947b..b6f819fd1e76 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktop_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py index 58d8e8c495f6..4d17b2dfa504 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Desktop_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktop_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py index 7d583f1491dd..3d5b118d7137 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -43,16 +44,21 @@ def main(): }, "customRdpProperty": None, "description": "des1", + "directUDP": "Enabled", "friendlyName": "friendly", "hostPoolType": "Pooled", "loadBalancerType": "BreadthFirst", + "managedPrivateUDP": "Enabled", + "managementType": "Automated", "maxSessionLimit": 999999, "personalDesktopAssignmentType": "Automatic", "preferredAppGroupType": "Desktop", + "publicUDP": "Enabled", "registrationInfo": { "expirationTime": "2020-10-01T14:01:54.9571247Z", "registrationTokenOperation": "Update", }, + "relayUDP": "Enabled", "ssoClientId": "client", "ssoClientSecretKeyVaultPath": "https://keyvault/secret", "ssoSecretType": "SharedKey", @@ -66,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py index 30ef526635f4..d2a17359cd83 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py index d774395db188..e43af14d1ec8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py index b9c61d910d28..799d04009958 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py index 5433bc9a1628..c1bbab361802 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py index f2f8ecad8fa9..8cc1ee46ae99 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPool_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py new file mode 100644 index 000000000000..2e059406a4db --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python host_pools_list_registration_token_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.host_pools.list_registration_tokens( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_ListRegistrationToken_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py index 82388e1af917..3eddd88adcf2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/HostPools_RetrieveRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_RetrieveRegistrationToken_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py index f2bdff869363..6b92cbffd1b1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -68,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackage_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py index ed4db6714575..87c3fa503ce1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackage_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py index 4221df096b95..4195c3ce768f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackage_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py index 76512ce69a8f..0679a44409bb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackage_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py index a61bacfd4dc1..a4ab73af5300 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/MsixPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackage_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py index de7cd47c7ead..175355ea2e99 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/OperationDescription_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/OperationDescription_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py index 347a812ff1f9..3db110119209 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py index f11494a4626e..f6b06f43c55e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_DeleteByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py index 78c12ba812f5..6af3da82f428 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_GetByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py index f484da865a1b..4c609f16a91c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_GetByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_GetByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py index 6bd2f22e9a6f..cff35c5c0004 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py index 23ff8d0eec94..3c04fc286191 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py index 3be897a7f53c..5c4a1086f59c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py index f190b60b4aff..f252d199e81e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateEndpointConnection_UpdateByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py index 29fc40869770..e138a1a3f131 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateLinkResources_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py index a8834b07a4a9..8a079e1d2698 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/PrivateLinkResources_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateLinkResources_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py index 5bd98f82ce20..b177495af163 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -74,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py index b94c9879a1cd..8ab28b69c11c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py index cdc193d77aa8..13c9614dc8fc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py index a4ccc4d2f3b1..04beedbccbb6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py index 8bbc064b5d82..2713a598fc1e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py index 43d3223af985..707dec5f9d18 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py index 7c475a40da18..af900699638e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -67,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py index 0d51d4e338d9..4137a81fa178 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py index 3a35b69d163f..cc388c729084 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py index b841cc3eb41b..97db6ff19656 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py index 9d36ca179a39..7908a4c5b99d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPersonalSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py index f87520f7b745..574bb04db8ce 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -57,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py index b95b9669dac9..a3227bba02e7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py index f83d30ca7c76..0b817fb861d6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py index 41bb73ba98e6..8e6559b057cd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py index eed711a358f3..25ba13b888fd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlanPooledSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py index 0b82204268e5..89d98a47339e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/ScalingPlan_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlan_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py new file mode 100644 index 000000000000..b7ab26576992 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py @@ -0,0 +1,92 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_create.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_configuration={ + "properties": { + "availabilityZones": [1, 3], + "bootDiagnosticsInfo": { + "enabled": True, + "storageUri": "https://myStorageAccountName.blob.core.windows.net", + }, + "customConfigurationScriptUrl": "https://storageaccountname.blob.core.windows.net/blobcontainer/file", + "diskInfo": {"type": "Standard_LRS"}, + "domainInfo": { + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "domainName": "wvdarmtest1.net", + "ouPath": "OU=testOU,DC=domain,DC=Domain,DC=com", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "bdefabc0-95b4-48b3-b645-8a753a63c4fa"}, + "joinType": "ActiveDirectory", + }, + "friendlyName": "InitialConfiguration", + "imageInfo": { + "customInfo": { + "resourceId": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/images/imageName" + }, + "marketplaceInfo": { + "exactVersion": "2019.0.20190115", + "offer": "Windows-10", + "publisher": "MicrosoftWindowsDesktop", + "sku": "19h2-ent", + }, + "type": "Marketplace", + }, + "networkInfo": { + "securityGroupId": "/subscriptions/.../resourceGroups/.../provider s/Microsoft.Network/networkSecurityGroups/nsg1", + "subnetId": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/virtualNetworks/.../subnets/subnet1", + }, + "securityInfo": {"secureBootEnabled": True, "type": "TrustedLaunch", "vTpmEnabled": True}, + "vmAdminCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "vmLocation": "eastus2", + "vmNamePrefix": "westus2-vm", + "vmResourceGroup": "myResourceGroup", + "vmSizeId": "Standard_D2s_v3", + "vmTags": {"Department": "myDepartment", "Team": "myTeam"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostConfigurations_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py new file mode 100644 index 000000000000..58c96e99fb29 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..b55bd52f3893 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py @@ -0,0 +1,43 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py new file mode 100644 index 000000000000..e11f92176b55 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_update.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostConfigurations_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py index 946b4d9da293..5d947d1a7c22 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHost_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py index b1f7b32304e2..9b26507bce39 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHost_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py index 16559e7d470b..1d41e1364a7e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHost_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py new file mode 100644 index 000000000000..c3bcf554e701 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_control_session_host_update_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.control_session_host_update.begin_post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + host_pool_update_control_parameter={"action": "Start", "cancelMessage": "Host pool update started"}, + ).result() + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_ControlSessionHostUpdate_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py new file mode 100644 index 000000000000..73645705bf0d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py @@ -0,0 +1,53 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_create.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_management={ + "properties": { + "scheduledDateTimeZone": "Alaskan Standard Time", + "update": { + "deleteOriginalVm": True, + "logOffDelayMinutes": 10, + "logOffMessage": "logging off for hostpool update", + "maxVmsRemoved": 4, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py new file mode 100644 index 000000000000..06317c270fa5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py new file mode 100644 index 000000000000..3648466faf73 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py @@ -0,0 +1,43 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_list_by_host_pool.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py new file mode 100644 index 000000000000..3cb5ffa43308 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py new file mode 100644 index 000000000000..e1bfaa1ef0e2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py @@ -0,0 +1,41 @@ +# 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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update_session_hosts_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.initiate_session_host_update.post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_UpdateSessionHosts_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py new file mode 100644 index 000000000000..320e32759113 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update_status_get.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements_update_status.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHostManagements_UpdateStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py new file mode 100644 index 000000000000..c3e54c59f03d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.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.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_retry_provisioning_post.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 = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.session_host.retry_provisioning( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_name="sessionHost1.microsoft.com", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHost_RetryProvisioning_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py index da99b9081f12..8721f8298ef6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/SessionHost_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHost_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py index 58f79ef2c86e..f7c1817f6a44 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/StartMenuItem_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/StartMenuItem_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py index 00ca1c1fc6d8..0d095fd43380 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py index fbe5371f406e..18d7b61e7fce 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Disconnect_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_Disconnect_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py index 469a091c203e..f85cf5f26cbb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py index 47507e0c5cbf..1423a79cd527 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py index 4bbaf72a8502..ab0607cf5cfc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py index c3bbd4fc1b59..03617d7c3f59 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/UserSession_SendMessage_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSession_SendMessage_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py index cd9254a84892..68a40eaff00f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py index 60a5346fd866..3beeaa4c1b1e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py index a2983f58eb4a..86290f52c53d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py index 3822f62ce5c9..2e1d08c5c4d2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py index 6a1aa43a6869..a3958c06a89c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py index e2ad9c4fac4c..d962c2d4f1fb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2023-09-05/examples/Workspace_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspace_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py new file mode 100644 index 000000000000..2bacd7394e96 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py @@ -0,0 +1,43 @@ +# 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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + desktopvirtualizationmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + desktopvirtualizationmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + desktopvirtualizationmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + desktopvirtualizationmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=desktopvirtualizationmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=desktopvirtualizationmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=desktopvirtualizationmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=desktopvirtualizationmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..54ab41f94a44 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtActiveSessionHostConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.active_session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.active_session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py new file mode 100644 index 000000000000..c5b00bf9b18e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtActiveSessionHostConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.active_session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.active_session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py new file mode 100644 index 000000000000..7ae24455f2cc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtAppAttachPackageInfoOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_import_method(self, resource_group): + response = self.client.app_attach_package_info.import_method( + resource_group_name=resource_group.name, + host_pool_name="str", + import_package_info_request={"packageArchitecture": "str", "path": "str"}, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py new file mode 100644 index 000000000000..f42393bff3a0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtAppAttachPackageInfoOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_import_method(self, resource_group): + response = self.client.app_attach_package_info.import_method( + resource_group_name=resource_group.name, + host_pool_name="str", + import_package_info_request={"packageArchitecture": "str", "path": "str"}, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py new file mode 100644 index 000000000000..82327e1fb0bc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtAppAttachPackageOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_attach_package.get( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.app_attach_package.create_or_update( + resource_group_name=resource_group.name, + app_attach_package_name="str", + app_attach_package={ + "location": "str", + "properties": { + "customData": "str", + "failHealthCheckOnStagingFailure": "str", + "hostPoolReferences": ["str"], + "image": { + "certificateExpiry": "2020-02-20 00:00:00", + "certificateName": "str", + "displayName": "str", + "imagePath": "str", + "isActive": bool, + "isPackageTimestamped": "str", + "isRegularRegistration": bool, + "lastUpdated": "2020-02-20 00:00:00", + "packageAlias": "str", + "packageApplications": [ + { + "appId": "str", + "appUserModelID": "str", + "description": "str", + "friendlyName": "str", + "iconImageName": "str", + "rawIcon": bytes("bytes", encoding="utf-8"), + "rawPng": bytes("bytes", encoding="utf-8"), + } + ], + "packageDependencies": [{"dependencyName": "str", "minVersion": "str", "publisher": "str"}], + "packageFamilyName": "str", + "packageFullName": "str", + "packageName": "str", + "packageRelativePath": "str", + "version": "str", + }, + "keyVaultURL": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_attach_package.delete( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_attach_package.update( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.app_attach_package.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.app_attach_package.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py new file mode 100644 index 000000000000..4ad4084c763d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtAppAttachPackageOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_attach_package.get( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.app_attach_package.create_or_update( + resource_group_name=resource_group.name, + app_attach_package_name="str", + app_attach_package={ + "location": "str", + "properties": { + "customData": "str", + "failHealthCheckOnStagingFailure": "str", + "hostPoolReferences": ["str"], + "image": { + "certificateExpiry": "2020-02-20 00:00:00", + "certificateName": "str", + "displayName": "str", + "imagePath": "str", + "isActive": bool, + "isPackageTimestamped": "str", + "isRegularRegistration": bool, + "lastUpdated": "2020-02-20 00:00:00", + "packageAlias": "str", + "packageApplications": [ + { + "appId": "str", + "appUserModelID": "str", + "description": "str", + "friendlyName": "str", + "iconImageName": "str", + "rawIcon": bytes("bytes", encoding="utf-8"), + "rawPng": bytes("bytes", encoding="utf-8"), + } + ], + "packageDependencies": [{"dependencyName": "str", "minVersion": "str", "publisher": "str"}], + "packageFamilyName": "str", + "packageFullName": "str", + "packageName": "str", + "packageRelativePath": "str", + "version": "str", + }, + "keyVaultURL": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_attach_package.delete( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_attach_package.update( + resource_group_name=resource_group.name, + app_attach_package_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.app_attach_package.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.app_attach_package.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py new file mode 100644 index 000000000000..e57d1e1262b2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtApplicationGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.application_groups.get( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.application_groups.create_or_update( + resource_group_name=resource_group.name, + application_group_name="str", + application_group={ + "applicationGroupType": "str", + "hostPoolArmPath": "str", + "location": "str", + "cloudPcResource": bool, + "description": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "showInFeed": bool, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "workspaceArmPath": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.application_groups.delete( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.application_groups.update( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.application_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.application_groups.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py new file mode 100644 index 000000000000..97a68d089bf6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtApplicationGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.application_groups.get( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.application_groups.create_or_update( + resource_group_name=resource_group.name, + application_group_name="str", + application_group={ + "applicationGroupType": "str", + "hostPoolArmPath": "str", + "location": "str", + "cloudPcResource": bool, + "description": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "showInFeed": bool, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "workspaceArmPath": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.application_groups.delete( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.application_groups.update( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.application_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.application_groups.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py new file mode 100644 index 000000000000..ebd128e50dfe --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtApplicationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.applications.get( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.applications.create_or_update( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + application={ + "commandLineSetting": "str", + "applicationType": "str", + "commandLineArguments": "str", + "description": "str", + "filePath": "str", + "friendlyName": "str", + "iconContent": bytes("bytes", encoding="utf-8"), + "iconHash": "str", + "iconIndex": 0, + "iconPath": "str", + "id": "str", + "msixPackageApplicationId": "str", + "msixPackageFamilyName": "str", + "name": "str", + "objectId": "str", + "showInPortal": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.applications.delete( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.applications.update( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.applications.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py new file mode 100644 index 000000000000..147dd5b174ee --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtApplicationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.applications.get( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.applications.create_or_update( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + application={ + "commandLineSetting": "str", + "applicationType": "str", + "commandLineArguments": "str", + "description": "str", + "filePath": "str", + "friendlyName": "str", + "iconContent": bytes("bytes", encoding="utf-8"), + "iconHash": "str", + "iconIndex": 0, + "iconPath": "str", + "id": "str", + "msixPackageApplicationId": "str", + "msixPackageFamilyName": "str", + "name": "str", + "objectId": "str", + "showInPortal": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.applications.delete( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.applications.update( + resource_group_name=resource_group.name, + application_group_name="str", + application_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.applications.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py new file mode 100644 index 000000000000..6038f7c59c77 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtControlSessionHostUpdateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_post(self, resource_group): + response = self.client.control_session_host_update.begin_post( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool_update_control_parameter={"action": "str", "cancelMessage": "str"}, + api_version="2024-08-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py new file mode 100644 index 000000000000..5ed1d99669a1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtControlSessionHostUpdateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_post(self, resource_group): + response = await ( + await self.client.control_session_host_update.begin_post( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool_update_control_parameter={"action": "str", "cancelMessage": "str"}, + api_version="2024-08-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py new file mode 100644 index 000000000000..05dc0f18f83f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtDesktopsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.desktops.get( + resource_group_name=resource_group.name, + application_group_name="str", + desktop_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.desktops.update( + resource_group_name=resource_group.name, + application_group_name="str", + desktop_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.desktops.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py new file mode 100644 index 000000000000..9308aa2b590f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtDesktopsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.desktops.get( + resource_group_name=resource_group.name, + application_group_name="str", + desktop_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.desktops.update( + resource_group_name=resource_group.name, + application_group_name="str", + desktop_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.desktops.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py new file mode 100644 index 000000000000..fb11edcfa663 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py @@ -0,0 +1,198 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtHostPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.host_pools.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.host_pools.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool={ + "hostPoolType": "str", + "loadBalancerType": "str", + "location": "str", + "preferredAppGroupType": "str", + "agentUpdate": { + "maintenanceWindowTimeZone": "str", + "maintenanceWindows": [{"dayOfWeek": "str", "hour": 0}], + "type": "str", + "useSessionHostLocalTime": bool, + }, + "appAttachPackageReferences": ["str"], + "applicationGroupReferences": ["str"], + "cloudPcResource": bool, + "customRdpProperty": "str", + "description": "str", + "directUDP": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "managedPrivateUDP": "str", + "managementType": "str", + "maxSessionLimit": 0, + "name": "str", + "objectId": "str", + "personalDesktopAssignmentType": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "publicNetworkAccess": "str", + "publicUDP": "str", + "registrationInfo": { + "expirationTime": "2020-02-20 00:00:00", + "registrationTokenOperation": "str", + "token": "str", + }, + "relayUDP": "str", + "ring": 0, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "ssoClientId": "str", + "ssoClientSecretKeyVaultPath": "str", + "ssoSecretType": "str", + "ssoadfsAuthority": "str", + "startVMOnConnect": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "validationEnvironment": bool, + "vmTemplate": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.host_pools.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.host_pools.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.host_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.host_pools.list( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retrieve_registration_token(self, resource_group): + response = self.client.host_pools.retrieve_registration_token( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_registration_tokens(self, resource_group): + response = self.client.host_pools.list_registration_tokens( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py new file mode 100644 index 000000000000..9ba99d9d2d42 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py @@ -0,0 +1,199 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtHostPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.host_pools.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.host_pools.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool={ + "hostPoolType": "str", + "loadBalancerType": "str", + "location": "str", + "preferredAppGroupType": "str", + "agentUpdate": { + "maintenanceWindowTimeZone": "str", + "maintenanceWindows": [{"dayOfWeek": "str", "hour": 0}], + "type": "str", + "useSessionHostLocalTime": bool, + }, + "appAttachPackageReferences": ["str"], + "applicationGroupReferences": ["str"], + "cloudPcResource": bool, + "customRdpProperty": "str", + "description": "str", + "directUDP": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "managedPrivateUDP": "str", + "managementType": "str", + "maxSessionLimit": 0, + "name": "str", + "objectId": "str", + "personalDesktopAssignmentType": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "publicNetworkAccess": "str", + "publicUDP": "str", + "registrationInfo": { + "expirationTime": "2020-02-20 00:00:00", + "registrationTokenOperation": "str", + "token": "str", + }, + "relayUDP": "str", + "ring": 0, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "ssoClientId": "str", + "ssoClientSecretKeyVaultPath": "str", + "ssoSecretType": "str", + "ssoadfsAuthority": "str", + "startVMOnConnect": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "validationEnvironment": bool, + "vmTemplate": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.host_pools.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.host_pools.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.host_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.host_pools.list( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retrieve_registration_token(self, resource_group): + response = await self.client.host_pools.retrieve_registration_token( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_registration_tokens(self, resource_group): + response = await self.client.host_pools.list_registration_tokens( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..cc8de1967387 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtInitiateSessionHostUpdateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post(self, resource_group): + response = self.client.initiate_session_host_update.post( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py new file mode 100644 index 000000000000..defee373211b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtInitiateSessionHostUpdateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post(self, resource_group): + response = await self.client.initiate_session_host_update.post( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py new file mode 100644 index 000000000000..b15714cb62e4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtMsixImagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_expand(self, resource_group): + response = self.client.msix_images.expand( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_image_uri={"uri": "str"}, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py new file mode 100644 index 000000000000..039d5aef952c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtMsixImagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_expand(self, resource_group): + response = self.client.msix_images.expand( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_image_uri={"uri": "str"}, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py new file mode 100644 index 000000000000..e984758887e2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtMSIXPackagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.msix_packages.get( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.msix_packages.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + msix_package={ + "displayName": "str", + "id": "str", + "imagePath": "str", + "isActive": bool, + "isRegularRegistration": bool, + "lastUpdated": "2020-02-20 00:00:00", + "name": "str", + "packageApplications": [ + { + "appId": "str", + "appUserModelID": "str", + "description": "str", + "friendlyName": "str", + "iconImageName": "str", + "rawIcon": bytes("bytes", encoding="utf-8"), + "rawPng": bytes("bytes", encoding="utf-8"), + } + ], + "packageDependencies": [{"dependencyName": "str", "minVersion": "str", "publisher": "str"}], + "packageFamilyName": "str", + "packageName": "str", + "packageRelativePath": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.msix_packages.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.msix_packages.update( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.msix_packages.list( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py new file mode 100644 index 000000000000..36b61db4d717 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtMSIXPackagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.msix_packages.get( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.msix_packages.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + msix_package={ + "displayName": "str", + "id": "str", + "imagePath": "str", + "isActive": bool, + "isRegularRegistration": bool, + "lastUpdated": "2020-02-20 00:00:00", + "name": "str", + "packageApplications": [ + { + "appId": "str", + "appUserModelID": "str", + "description": "str", + "friendlyName": "str", + "iconImageName": "str", + "rawIcon": bytes("bytes", encoding="utf-8"), + "rawPng": bytes("bytes", encoding="utf-8"), + } + ], + "packageDependencies": [{"dependencyName": "str", "minVersion": "str", "publisher": "str"}], + "packageFamilyName": "str", + "packageName": "str", + "packageRelativePath": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.msix_packages.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.msix_packages.update( + resource_group_name=resource_group.name, + host_pool_name="str", + msix_package_full_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.msix_packages.list( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py new file mode 100644 index 000000000000..f06084b85342 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py new file mode 100644 index 000000000000..35f7b79dfd24 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..e867d9c83b11 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.list_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.get_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.delete_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.update_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.get_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.delete_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.update_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..3d492a5b4566 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py @@ -0,0 +1,156 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.list_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_workspace(self, resource_group): + response = await self.client.private_endpoint_connections.get_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_by_workspace(self, resource_group): + response = await self.client.private_endpoint_connections.delete_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_by_workspace(self, resource_group): + response = await self.client.private_endpoint_connections.update_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_host_pool(self, resource_group): + response = await self.client.private_endpoint_connections.get_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_by_host_pool(self, resource_group): + response = await self.client.private_endpoint_connections.delete_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_by_host_pool(self, resource_group): + response = await self.client.private_endpoint_connections.update_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + private_endpoint_connection_name="str", + connection={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py new file mode 100644 index 000000000000..75f747848625 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_workspace(self, resource_group): + response = self.client.private_link_resources.list_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.private_link_resources.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py new file mode 100644 index 000000000000..2c6954fe6809 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_workspace(self, resource_group): + response = self.client.private_link_resources.list_by_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.private_link_resources.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py new file mode 100644 index 000000000000..c1164838e9ce --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlanPersonalSchedulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.scaling_plan_personal_schedules.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.scaling_plan_personal_schedules.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + scaling_plan_schedule={ + "daysOfWeek": ["str"], + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampUpStartTime": {"hour": 0, "minute": 0}, + "id": "str", + "name": "str", + "offPeakActionOnDisconnect": "str", + "offPeakActionOnLogoff": "str", + "offPeakMinutesToWaitOnDisconnect": 0, + "offPeakMinutesToWaitOnLogoff": 0, + "offPeakStartVMOnConnect": "str", + "peakActionOnDisconnect": "str", + "peakActionOnLogoff": "str", + "peakMinutesToWaitOnDisconnect": 0, + "peakMinutesToWaitOnLogoff": 0, + "peakStartVMOnConnect": "str", + "rampDownActionOnDisconnect": "str", + "rampDownActionOnLogoff": "str", + "rampDownMinutesToWaitOnDisconnect": 0, + "rampDownMinutesToWaitOnLogoff": 0, + "rampDownStartVMOnConnect": "str", + "rampUpActionOnDisconnect": "str", + "rampUpActionOnLogoff": "str", + "rampUpAutoStartHosts": "str", + "rampUpMinutesToWaitOnDisconnect": 0, + "rampUpMinutesToWaitOnLogoff": 0, + "rampUpStartVMOnConnect": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.scaling_plan_personal_schedules.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.scaling_plan_personal_schedules.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.scaling_plan_personal_schedules.list( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py new file mode 100644 index 000000000000..a1c8dceff49d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlanPersonalSchedulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.scaling_plan_personal_schedules.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.scaling_plan_personal_schedules.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + scaling_plan_schedule={ + "daysOfWeek": ["str"], + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampUpStartTime": {"hour": 0, "minute": 0}, + "id": "str", + "name": "str", + "offPeakActionOnDisconnect": "str", + "offPeakActionOnLogoff": "str", + "offPeakMinutesToWaitOnDisconnect": 0, + "offPeakMinutesToWaitOnLogoff": 0, + "offPeakStartVMOnConnect": "str", + "peakActionOnDisconnect": "str", + "peakActionOnLogoff": "str", + "peakMinutesToWaitOnDisconnect": 0, + "peakMinutesToWaitOnLogoff": 0, + "peakStartVMOnConnect": "str", + "rampDownActionOnDisconnect": "str", + "rampDownActionOnLogoff": "str", + "rampDownMinutesToWaitOnDisconnect": 0, + "rampDownMinutesToWaitOnLogoff": 0, + "rampDownStartVMOnConnect": "str", + "rampUpActionOnDisconnect": "str", + "rampUpActionOnLogoff": "str", + "rampUpAutoStartHosts": "str", + "rampUpMinutesToWaitOnDisconnect": 0, + "rampUpMinutesToWaitOnLogoff": 0, + "rampUpStartVMOnConnect": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.scaling_plan_personal_schedules.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.scaling_plan_personal_schedules.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.scaling_plan_personal_schedules.list( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py new file mode 100644 index 000000000000..c4d6a58d93d0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlanPooledSchedulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + scaling_plan_schedule={ + "daysOfWeek": ["str"], + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownCapacityThresholdPct": 0, + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampUpCapacityThresholdPct": 0, + "rampUpStartTime": {"hour": 0, "minute": 0}, + "id": "str", + "name": "str", + "offPeakLoadBalancingAlgorithm": "str", + "peakLoadBalancingAlgorithm": "str", + "rampDownForceLogoffUsers": bool, + "rampDownLoadBalancingAlgorithm": "str", + "rampDownMinimumHostsPct": 0, + "rampDownNotificationMessage": "str", + "rampDownStopHostsWhen": "str", + "rampDownWaitTimeMinutes": 0, + "rampUpLoadBalancingAlgorithm": "str", + "rampUpMinimumHostsPct": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.list( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py new file mode 100644 index 000000000000..f6a90c528aa0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlanPooledSchedulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.scaling_plan_pooled_schedules.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.scaling_plan_pooled_schedules.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + scaling_plan_schedule={ + "daysOfWeek": ["str"], + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownCapacityThresholdPct": 0, + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampUpCapacityThresholdPct": 0, + "rampUpStartTime": {"hour": 0, "minute": 0}, + "id": "str", + "name": "str", + "offPeakLoadBalancingAlgorithm": "str", + "peakLoadBalancingAlgorithm": "str", + "rampDownForceLogoffUsers": bool, + "rampDownLoadBalancingAlgorithm": "str", + "rampDownMinimumHostsPct": 0, + "rampDownNotificationMessage": "str", + "rampDownStopHostsWhen": "str", + "rampDownWaitTimeMinutes": 0, + "rampUpLoadBalancingAlgorithm": "str", + "rampUpMinimumHostsPct": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.scaling_plan_pooled_schedules.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.scaling_plan_pooled_schedules.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan_schedule_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.scaling_plan_pooled_schedules.list( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py new file mode 100644 index 000000000000..6c07d4d823fe --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlansOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.scaling_plans.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.scaling_plans.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan={ + "location": "str", + "timeZone": "str", + "description": "str", + "etag": "str", + "exclusionTag": "str", + "friendlyName": "str", + "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], + "hostPoolType": "Pooled", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "schedules": [ + { + "daysOfWeek": ["str"], + "name": "str", + "offPeakLoadBalancingAlgorithm": "str", + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakLoadBalancingAlgorithm": "str", + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownCapacityThresholdPct": 0, + "rampDownForceLogoffUsers": bool, + "rampDownLoadBalancingAlgorithm": "str", + "rampDownMinimumHostsPct": 0, + "rampDownNotificationMessage": "str", + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampDownStopHostsWhen": "str", + "rampDownWaitTimeMinutes": 0, + "rampUpCapacityThresholdPct": 0, + "rampUpLoadBalancingAlgorithm": "str", + "rampUpMinimumHostsPct": 0, + "rampUpStartTime": {"hour": 0, "minute": 0}, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.scaling_plans.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.scaling_plans.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.scaling_plans.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.scaling_plans.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.scaling_plans.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py new file mode 100644 index 000000000000..36bdcb99a8af --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py @@ -0,0 +1,156 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtScalingPlansOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.scaling_plans.get( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.scaling_plans.create( + resource_group_name=resource_group.name, + scaling_plan_name="str", + scaling_plan={ + "location": "str", + "timeZone": "str", + "description": "str", + "etag": "str", + "exclusionTag": "str", + "friendlyName": "str", + "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], + "hostPoolType": "Pooled", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "schedules": [ + { + "daysOfWeek": ["str"], + "name": "str", + "offPeakLoadBalancingAlgorithm": "str", + "offPeakStartTime": {"hour": 0, "minute": 0}, + "peakLoadBalancingAlgorithm": "str", + "peakStartTime": {"hour": 0, "minute": 0}, + "rampDownCapacityThresholdPct": 0, + "rampDownForceLogoffUsers": bool, + "rampDownLoadBalancingAlgorithm": "str", + "rampDownMinimumHostsPct": 0, + "rampDownNotificationMessage": "str", + "rampDownStartTime": {"hour": 0, "minute": 0}, + "rampDownStopHostsWhen": "str", + "rampDownWaitTimeMinutes": 0, + "rampUpCapacityThresholdPct": 0, + "rampUpLoadBalancingAlgorithm": "str", + "rampUpMinimumHostsPct": 0, + "rampUpStartTime": {"hour": 0, "minute": 0}, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.scaling_plans.delete( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.scaling_plans.update( + resource_group_name=resource_group.name, + scaling_plan_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.scaling_plans.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.scaling_plans.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.scaling_plans.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py new file mode 100644 index 000000000000..45a9895064e0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.session_host_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_configuration={ + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "networkInfo": {"subnetId": "str", "securityGroupId": "str"}, + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmNamePrefix": "str", + "vmSizeId": "str", + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "friendlyName": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "securityInfo": {"secureBootEnabled": bool, "type": "str", "vTpmEnabled": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "2020-02-20 00:00:00", + "vmLocation": "str", + "vmResourceGroup": "str", + "vmTags": {"str": "str"}, + }, + api_version="2024-08-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.session_host_configurations.begin_update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py new file mode 100644 index 000000000000..1b170718648e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.session_host_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_configuration={ + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "str", + "usernameKeyVaultSecretUri": "str", + }, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "networkInfo": {"subnetId": "str", "securityGroupId": "str"}, + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmNamePrefix": "str", + "vmSizeId": "str", + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "friendlyName": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "securityInfo": {"secureBootEnabled": bool, "type": "str", "vTpmEnabled": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "2020-02-20 00:00:00", + "vmLocation": "str", + "vmResourceGroup": "str", + "vmTags": {"str": "str"}, + }, + api_version="2024-08-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.session_host_configurations.begin_update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py new file mode 100644 index 000000000000..431f2f909748 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_managements.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.session_host_managements.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_management={ + "scheduledDateTimeZone": "str", + "update": {"logOffDelayMinutes": 0, "maxVmsRemoved": 0, "deleteOriginalVm": bool, "logOffMessage": ""}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.session_host_managements.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_managements.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py new file mode 100644 index 000000000000..41e6ff9e56cd --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_managements.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.session_host_managements.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_management={ + "scheduledDateTimeZone": "str", + "update": {"logOffDelayMinutes": 0, "maxVmsRemoved": 0, "deleteOriginalVm": bool, "logOffMessage": ""}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.session_host_managements.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_managements.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..d7304111670a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsUpdateStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_managements_update_status.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py new file mode 100644 index 000000000000..acf145ea845b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsUpdateStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_managements_update_status.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py new file mode 100644 index 000000000000..80b323919aa0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retry_provisioning(self, resource_group): + response = self.client.session_host.retry_provisioning( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py new file mode 100644 index 000000000000..c38e425a547b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retry_provisioning(self, resource_group): + response = await self.client.session_host.retry_provisioning( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py new file mode 100644 index 000000000000..810306b69828 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_hosts.get( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.session_hosts.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.session_hosts.update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.session_hosts.list( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py new file mode 100644 index 000000000000..f355df7293af --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_hosts.get( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.session_hosts.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.session_hosts.update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.session_hosts.list( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py new file mode 100644 index 000000000000..46e266c29f8b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtStartMenuItemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.start_menu_items.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py new file mode 100644 index 000000000000..f70283a2eba2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtStartMenuItemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.start_menu_items.list( + resource_group_name=resource_group.name, + application_group_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py new file mode 100644 index 000000000000..d03064d11e77 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtUserSessionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.user_sessions.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.user_sessions.get( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.user_sessions.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.user_sessions.list( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disconnect(self, resource_group): + response = self.client.user_sessions.disconnect( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_send_message(self, resource_group): + response = self.client.user_sessions.send_message( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py new file mode 100644 index 000000000000..d7be7623c5b5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtUserSessionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.user_sessions.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.user_sessions.get( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.user_sessions.delete( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.user_sessions.list( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disconnect(self, resource_group): + response = await self.client.user_sessions.disconnect( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_send_message(self, resource_group): + response = await self.client.user_sessions.send_message( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + user_session_id="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py new file mode 100644 index 000000000000..b674b78d9a02 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtWorkspacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workspaces.get( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.workspaces.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + workspace={ + "location": "str", + "applicationGroupReferences": ["str"], + "cloudPcResource": bool, + "description": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "publicNetworkAccess": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.workspaces.delete( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.workspaces.update( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.workspaces.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py new file mode 100644 index 000000000000..c2d2bfa669bf --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py @@ -0,0 +1,144 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtWorkspacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workspaces.get( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.workspaces.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + workspace={ + "location": "str", + "applicationGroupReferences": ["str"], + "cloudPcResource": bool, + "description": "str", + "etag": "str", + "friendlyName": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "managedBy": "str", + "name": "str", + "objectId": "str", + "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "publicNetworkAccess": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.workspaces.delete( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.workspaces.update( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.workspaces.list_by_subscription( + api_version="2024-08-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py index 2fa9a604d59d..d28166930acb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )