From 6160dad7915dc2025e2eb58896ebe15b50e17bc6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 21 Feb 2025 22:17:15 +0000 Subject: [PATCH] CodeGen from PR 31722 in Azure/azure-rest-api-specs Merge 852f93c797677818c8232158db3b1e80189766c4 into bbdbd8545dedd6436b8e30efe45270367389a9b6 --- .../_meta.json | 6 +- .../mgmt/desktopvirtualization/__init__.py | 12 +- .../desktopvirtualization/_configuration.py | 7 +- .../_desktop_virtualization_mgmt_client.py | 140 +- .../desktopvirtualization/_serialization.py | 434 +- .../mgmt/desktopvirtualization/_version.py | 2 +- .../desktopvirtualization/aio/__init__.py | 12 +- .../aio/_configuration.py | 7 +- .../_desktop_virtualization_mgmt_client.py | 142 +- .../aio/operations/__init__.py | 84 +- ..._session_host_configurations_operations.py | 204 + .../_app_attach_package_info_operations.py | 28 +- .../_app_attach_package_operations.py | 420 +- .../_application_groups_operations.py | 451 +- .../operations/_applications_operations.py | 298 +- ..._control_session_host_update_operations.py | 252 + .../aio/operations/_desktops_operations.py | 220 +- .../aio/operations/_host_pools_operations.py | 509 +- ...initiate_session_host_update_operations.py | 188 + .../aio/operations/_msix_images_operations.py | 32 +- .../operations/_msix_packages_operations.py | 309 +- .../aio/operations/_operations.py | 16 +- ...private_endpoint_connections_operations.py | 489 +- .../_private_link_resources_operations.py | 43 +- ...ling_plan_personal_schedules_operations.py | 322 +- ...caling_plan_pooled_schedules_operations.py | 322 +- .../operations/_scaling_plans_operations.py | 802 +-- ..._session_host_configurations_operations.py | 628 +++ .../_session_host_managements_operations.py | 472 ++ ...st_managements_update_status_operations.py | 111 + .../operations/_session_hosts_operations.py | 336 +- .../_start_menu_items_operations.py | 10 +- .../operations/_user_sessions_operations.py | 274 +- .../aio/operations/_workspaces_operations.py | 427 +- .../desktopvirtualization/models/__init__.py | 395 +- ...esktop_virtualization_mgmt_client_enums.py | 261 +- .../models/_models_py3.py | 4755 ++++++++++++----- .../operations/__init__.py | 84 +- ..._session_host_configurations_operations.py | 272 + .../_app_attach_package_info_operations.py | 30 +- .../_app_attach_package_operations.py | 521 +- .../_application_groups_operations.py | 601 +-- .../operations/_applications_operations.py | 364 +- ..._control_session_host_update_operations.py | 293 + .../operations/_desktops_operations.py | 280 +- .../operations/_host_pools_operations.py | 706 +-- ...initiate_session_host_update_operations.py | 229 + .../operations/_msix_images_operations.py | 34 +- .../operations/_msix_packages_operations.py | 391 +- .../operations/_operations.py | 18 +- ...private_endpoint_connections_operations.py | 628 +-- .../_private_link_resources_operations.py | 67 +- ...ling_plan_personal_schedules_operations.py | 392 +- ...caling_plan_pooled_schedules_operations.py | 392 +- .../operations/_scaling_plans_operations.py | 890 +-- ..._session_host_configurations_operations.py | 768 +++ .../_session_host_managements_operations.py | 615 +++ ...st_managements_update_status_operations.py | 149 + .../operations/_session_hosts_operations.py | 428 +- .../_start_menu_items_operations.py | 12 +- .../operations/_user_sessions_operations.py | 342 +- .../operations/_workspaces_operations.py | 527 +- .../active_session_host_configurations_get.py | 42 + ...n_host_configurations_list_by_host_pool.py | 43 + ...=> app_attach_package_create_or_update.py} | 4 +- .../app_attach_package_delete.py | 2 +- .../app_attach_package_get.py | 2 +- ...t.py => app_attach_package_info_import.py} | 5 +- ...p_attach_package_list_by_resource_group.py | 2 +- ...app_attach_package_list_by_subscription.py | 2 +- .../app_attach_package_update.py | 2 +- ...=> application_groups_create_or_update.py} | 4 +- ...delete.py => application_groups_delete.py} | 4 +- ...group_get.py => application_groups_get.py} | 4 +- ...lication_groups_list_by_resource_group.py} | 4 +- ...pplication_groups_list_by_subscription.py} | 4 +- ...update.py => application_groups_update.py} | 4 +- ...te.py => applications_create_or_update.py} | 4 +- ...ation_delete.py => applications_delete.py} | 4 +- ...application_get.py => applications_get.py} | 4 +- ...plication_list.py => applications_list.py} | 4 +- ...ation_update.py => applications_update.py} | 4 +- .../{desktop_get.py => desktops_get.py} | 4 +- .../{desktop_list.py => desktops_list.py} | 4 +- .../{desktop_update.py => desktops_update.py} | 4 +- ...reate.py => host_pool_create_or_update.py} | 9 +- .../{host_pool_list.py => host_pool_lists.py} | 4 +- ...st_pool_delete.py => host_pools_delete.py} | 4 +- .../{host_pool_get.py => host_pools_get.py} | 4 +- ...y => host_pools_list_by_resource_group.py} | 4 +- ...=> host_pools_list_registration_tokens.py} | 4 +- ...host_pools_retrieve_registration_token.py} | 4 +- ...st_pool_update.py => host_pools_update.py} | 4 +- .../generated_samples/msix_images_expand.py | 43 + ...e.py => msix_packages_create_or_update.py} | 4 +- ...kage_delete.py => msix_packages_delete.py} | 4 +- ...ix_package_get.py => msix_packages_get.py} | 4 +- ..._package_list.py => msix_packages_list.py} | 4 +- ...kage_update.py => msix_packages_update.py} | 5 +- ...description_list.py => operations_list.py} | 4 +- ...dpoint_connections_delete_by_host_pool.py} | 4 +- ...dpoint_connections_delete_by_workspace.py} | 4 +- ..._endpoint_connections_get_by_host_pool.py} | 4 +- ..._endpoint_connections_get_by_workspace.py} | 4 +- ...endpoint_connections_list_by_host_pool.py} | 4 +- ...endpoint_connections_list_by_workspace.py} | 4 +- ...dpoint_connections_update_by_host_pool.py} | 4 +- ...dpoint_connections_update_by_workspace.py} | 4 +- ...rivate_link_resources_list_by_host_pool.py | 2 +- ...rivate_link_resources_list_by_workspace.py | 2 +- ...scaling_plan_personal_schedules_create.py} | 4 +- ...scaling_plan_personal_schedules_delete.py} | 4 +- ...=> scaling_plan_personal_schedules_get.py} | 4 +- ...> scaling_plan_personal_schedules_list.py} | 4 +- ...scaling_plan_personal_schedules_update.py} | 4 +- ...> scaling_plan_pooled_schedules_create.py} | 4 +- ...> scaling_plan_pooled_schedules_delete.py} | 4 +- ...y => scaling_plan_pooled_schedules_get.py} | 4 +- ... => scaling_plan_pooled_schedules_list.py} | 4 +- ...> scaling_plan_pooled_schedules_update.py} | 4 +- ...plan_create.py => scaling_plans_create.py} | 4 +- ...plan_delete.py => scaling_plans_delete.py} | 4 +- ...aling_plan_get.py => scaling_plans_get.py} | 4 +- ....py => scaling_plans_list_by_host_pool.py} | 4 +- ...> scaling_plans_list_by_resource_group.py} | 4 +- ... => scaling_plans_list_by_subscription.py} | 4 +- ...plan_update.py => scaling_plans_update.py} | 4 +- ...on_host_configurations_create_or_update.py | 92 + .../session_host_configurations_get.py | 42 + ...n_host_configurations_list_by_host_pool.py | 43 + .../session_host_configurations_update.py | 42 + ...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 + ...host_delete.py => session_hosts_delete.py} | 4 +- ...ssion_host_get.py => session_hosts_get.py} | 4 +- ...ion_host_list.py => session_hosts_list.py} | 4 +- ...host_update.py => session_hosts_update.py} | 4 +- ..._item_list.py => start_menu_items_list.py} | 4 +- .../generated_samples/user_session_get.py | 2 +- ...sion_delete.py => user_sessions_delete.py} | 4 +- ...ct_post.py => user_sessions_disconnect.py} | 4 +- ..._session_list.py => user_sessions_list.py} | 4 +- ....py => user_sessions_list_by_host_pool.py} | 4 +- ..._post.py => user_sessions_send_message.py} | 4 +- ...eate.py => workspaces_create_or_update.py} | 4 +- ...rkspace_delete.py => workspaces_delete.py} | 4 +- .../{workspace_get.py => workspaces_get.py} | 4 +- ...y => workspaces_list_by_resource_group.py} | 4 +- ....py => workspaces_list_by_subscription.py} | 4 +- ...rkspace_update.py => workspaces_update.py} | 4 +- .../generated_tests/conftest.py | 2 +- ..._session_host_configurations_operations.py | 43 + ...on_host_configurations_operations_async.py | 44 + ...mgmt_app_attach_package_info_operations.py | 5 +- ...pp_attach_package_info_operations_async.py | 5 +- ...tion_mgmt_app_attach_package_operations.py | 131 +- ...gmt_app_attach_package_operations_async.py | 131 +- ...tion_mgmt_application_groups_operations.py | 69 +- ...gmt_application_groups_operations_async.py | 69 +- ...ualization_mgmt_applications_operations.py | 44 +- ...tion_mgmt_applications_operations_async.py | 44 +- ..._control_session_host_update_operations.py | 32 + ...ol_session_host_update_operations_async.py | 35 + ...virtualization_mgmt_desktops_operations.py | 24 +- ...lization_mgmt_desktops_operations_async.py | 24 +- ...rtualization_mgmt_host_pools_operations.py | 102 +- ...zation_mgmt_host_pools_operations_async.py | 102 +- ...initiate_session_host_update_operations.py | 31 + ...te_session_host_update_operations_async.py | 32 + ...tualization_mgmt_msix_images_operations.py | 5 +- ...ation_mgmt_msix_images_operations_async.py | 5 +- ...alization_mgmt_msix_packages_operations.py | 58 +- ...ion_mgmt_msix_packages_operations_async.py | 58 +- ..._desktop_virtualization_mgmt_operations.py | 4 +- ...op_virtualization_mgmt_operations_async.py | 4 +- ...private_endpoint_connections_operations.py | 86 +- ...e_endpoint_connections_operations_async.py | 86 +- ..._mgmt_private_link_resources_operations.py | 16 +- ...private_link_resources_operations_async.py | 16 +- ...ling_plan_personal_schedules_operations.py | 52 +- ...lan_personal_schedules_operations_async.py | 52 +- ...caling_plan_pooled_schedules_operations.py | 56 +- ..._plan_pooled_schedules_operations_async.py | 56 +- ...alization_mgmt_scaling_plans_operations.py | 93 +- ...ion_mgmt_scaling_plans_operations_async.py | 93 +- ..._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 + ...alization_mgmt_session_hosts_operations.py | 37 +- ...ion_mgmt_session_hosts_operations_async.py | 37 +- ...zation_mgmt_start_menu_items_operations.py | 4 +- ..._mgmt_start_menu_items_operations_async.py | 4 +- ...alization_mgmt_user_sessions_operations.py | 40 +- ...ion_mgmt_user_sessions_operations_async.py | 40 +- ...rtualization_mgmt_workspaces_operations.py | 85 +- ...zation_mgmt_workspaces_operations_async.py | 85 +- 205 files changed, 17399 insertions(+), 8550 deletions(-) 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/_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/operations/_active_session_host_configurations_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/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 rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{app_attach_package_create.py => app_attach_package_create_or_update.py} (95%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{app_attach_package_info_import_post.py => app_attach_package_info_import.py} (86%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_create.py => application_groups_create_or_update.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_delete.py => application_groups_delete.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_get.py => application_groups_get.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_list_by_resource_group.py => application_groups_list_by_resource_group.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_list_by_subscription.py => application_groups_list_by_subscription.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_group_update.py => application_groups_update.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_create.py => applications_create_or_update.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_delete.py => applications_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_get.py => applications_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_list.py => applications_list.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{application_update.py => applications_update.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{desktop_get.py => desktops_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{desktop_list.py => desktops_list.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{desktop_update.py => desktops_update.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_create.py => host_pool_create_or_update.py} (88%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_list.py => host_pool_lists.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_delete.py => host_pools_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_get.py => host_pools_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_list_by_resource_group.py => host_pools_list_by_resource_group.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pools_list_registration_token_post.py => host_pools_list_registration_tokens.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pools_retrieve_registration_token_post.py => host_pools_retrieve_registration_token.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{host_pool_update.py => host_pools_update.py} (91%) create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_images_expand.py rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_package_create.py => msix_packages_create_or_update.py} (94%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_package_delete.py => msix_packages_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_package_get.py => msix_packages_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_package_list.py => msix_packages_list.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{msix_package_update.py => msix_packages_update.py} (85%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{operation_description_list.py => operations_list.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_delete_by_host_pool.py => private_endpoint_connections_delete_by_host_pool.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_delete_by_workspace.py => private_endpoint_connections_delete_by_workspace.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_get_by_host_pool.py => private_endpoint_connections_get_by_host_pool.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_get_by_workspace.py => private_endpoint_connections_get_by_workspace.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_list_by_host_pool.py => private_endpoint_connections_list_by_host_pool.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_list_by_workspace.py => private_endpoint_connections_list_by_workspace.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_update_by_host_pool.py => private_endpoint_connections_update_by_host_pool.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{private_endpoint_connection_update_by_workspace.py => private_endpoint_connections_update_by_workspace.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_personal_schedule_create.py => scaling_plan_personal_schedules_create.py} (94%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_personal_schedule_delete.py => scaling_plan_personal_schedules_delete.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_personal_schedule_get.py => scaling_plan_personal_schedules_get.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_personal_schedule_list.py => scaling_plan_personal_schedules_list.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_personal_schedule_update.py => scaling_plan_personal_schedules_update.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_pooled_schedule_create.py => scaling_plan_pooled_schedules_create.py} (93%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_pooled_schedule_delete.py => scaling_plan_pooled_schedules_delete.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_pooled_schedule_get.py => scaling_plan_pooled_schedules_get.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_pooled_schedule_list.py => scaling_plan_pooled_schedules_list.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_pooled_schedule_update.py => scaling_plan_pooled_schedules_update.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_create.py => scaling_plans_create.py} (96%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_delete.py => scaling_plans_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_get.py => scaling_plans_get.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_list_by_host_pool.py => scaling_plans_list_by_host_pool.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_list_by_resource_group.py => scaling_plans_list_by_resource_group.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_list_by_subscription.py => scaling_plans_list_by_subscription.py} (89%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{scaling_plan_update.py => scaling_plans_update.py} (91%) create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create_or_update.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 rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{session_host_delete.py => session_hosts_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{session_host_get.py => session_hosts_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{session_host_list.py => session_hosts_list.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{session_host_update.py => session_hosts_update.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{start_menu_item_list.py => start_menu_items_list.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{user_session_delete.py => user_sessions_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{user_session_disconnect_post.py => user_sessions_disconnect.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{user_session_list.py => user_sessions_list.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{user_session_list_by_host_pool.py => user_sessions_list_by_host_pool.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{user_session_send_message_post.py => user_sessions_send_message.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_create.py => workspaces_create_or_update.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_delete.py => workspaces_delete.py} (91%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_get.py => workspaces_get.py} (92%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_list_by_resource_group.py => workspaces_list_by_resource_group.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_list_by_subscription.py => workspaces_list_by_subscription.py} (90%) rename sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/{workspace_update.py => workspaces_update.py} (91%) 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_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_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_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 diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index e7cc76c50156..c872ba832b8e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f1e65f90e77a72258801439e757fc76ecb13a7fc", + "commit": "277ec005b36dd67494989104c3124acfea3bf497", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "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=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-04 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --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.27.4 --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/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py index 8a587f87b999..23116ec32b46 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._desktop_virtualization_mgmt_client import DesktopVirtualizationMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._desktop_virtualization_mgmt_client import DesktopVirtualizationMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "DesktopVirtualizationMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py index 835e232059af..9e747efe2ef2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -28,13 +27,13 @@ class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-03". 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: - api_version: str = kwargs.pop("api_version", "2024-04-03") + api_version: str = kwargs.pop("api_version", "2024-08-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 0205fa978041..76295610a08f 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 @@ -19,12 +19,15 @@ from ._configuration import DesktopVirtualizationMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + ActiveSessionHostConfigurationsOperations, AppAttachPackageInfoOperations, AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -33,6 +36,9 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -40,65 +46,85 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """DesktopVirtualizationMgmtClient. +class DesktopVirtualizationMgmtClient: # pylint: disable=too-many-instance-attributes + """This Typespec represents the Desktop Virtualization API interfaces. :ivar operations: Operations operations :vartype operations: azure.mgmt.desktopvirtualization.operations.Operations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageOperations + :ivar application_groups: ApplicationGroupsOperations operations + :vartype application_groups: + azure.mgmt.desktopvirtualization.operations.ApplicationGroupsOperations + :ivar host_pools: HostPoolsOperations operations + :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations + :ivar scaling_plans: ScalingPlansOperations operations + :vartype scaling_plans: azure.mgmt.desktopvirtualization.operations.ScalingPlansOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.desktopvirtualization.operations.WorkspacesOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: azure.mgmt.desktopvirtualization.operations.ApplicationsOperations + :ivar desktops: DesktopsOperations operations + :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations + :ivar start_menu_items: StartMenuItemsOperations operations + :vartype start_menu_items: azure.mgmt.desktopvirtualization.operations.StartMenuItemsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.operations.ActiveSessionHostConfigurationsOperations + :ivar msix_images: MsixImagesOperations operations + :vartype msix_images: azure.mgmt.desktopvirtualization.operations.MsixImagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.operations.AppAttachPackageInfoOperations + :ivar msix_packages: MSIXPackagesOperations operations + :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.desktopvirtualization.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.desktopvirtualization.operations.PrivateLinkResourcesOperations - :ivar scaling_plans: ScalingPlansOperations operations - :vartype scaling_plans: azure.mgmt.desktopvirtualization.operations.ScalingPlansOperations - :ivar scaling_plan_pooled_schedules: ScalingPlanPooledSchedulesOperations operations - :vartype scaling_plan_pooled_schedules: - azure.mgmt.desktopvirtualization.operations.ScalingPlanPooledSchedulesOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.operations.SessionHostConfigurationsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.operations.ControlSessionHostUpdateOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.operations.InitiateSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_hosts: SessionHostsOperations operations + :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations + :ivar user_sessions: UserSessionsOperations operations + :vartype user_sessions: azure.mgmt.desktopvirtualization.operations.UserSessionsOperations :ivar scaling_plan_personal_schedules: ScalingPlanPersonalSchedulesOperations operations :vartype scaling_plan_personal_schedules: azure.mgmt.desktopvirtualization.operations.ScalingPlanPersonalSchedulesOperations - :ivar application_groups: ApplicationGroupsOperations operations - :vartype application_groups: - azure.mgmt.desktopvirtualization.operations.ApplicationGroupsOperations - :ivar start_menu_items: StartMenuItemsOperations operations - :vartype start_menu_items: azure.mgmt.desktopvirtualization.operations.StartMenuItemsOperations - :ivar applications: ApplicationsOperations operations - :vartype applications: azure.mgmt.desktopvirtualization.operations.ApplicationsOperations - :ivar desktops: DesktopsOperations operations - :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations - :ivar host_pools: HostPoolsOperations operations - :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations - :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 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 + :ivar scaling_plan_pooled_schedules: ScalingPlanPooledSchedulesOperations operations + :vartype scaling_plan_pooled_schedules: + azure.mgmt.desktopvirtualization.operations.ScalingPlanPooledSchedulesOperations :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. 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 "2024-04-03". 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__( @@ -136,35 +162,53 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.application_groups = ApplicationGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) - self.scaling_plan_pooled_schedules = ScalingPlanPooledSchedulesOperations( + self.session_host_configurations = SessionHostConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.scaling_plan_personal_schedules = ScalingPlanPersonalSchedulesOperations( + self.session_host_managements = SessionHostManagementsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.application_groups = ApplicationGroupsOperations( + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) - 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.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(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.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plan_personal_schedules = ScalingPlanPersonalSchedulesOperations( 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.scaling_plan_pooled_schedules = ScalingPlanPooledSchedulesOperations( self._client, self._config, self._serialize, self._deserialize ) 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 8139854b97bb..b24ab2885450 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -184,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -206,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -235,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1403,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1416,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1720,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1743,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1834,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1849,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1877,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1887,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1924,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1939,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1976,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1996,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py index 48944bf3938a..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 = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py index 224638cef30a..0a80cf6d1a10 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._desktop_virtualization_mgmt_client import DesktopVirtualizationMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._desktop_virtualization_mgmt_client import DesktopVirtualizationMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "DesktopVirtualizationMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py index 50ef97143926..8e750faf23e5 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 @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -28,13 +27,13 @@ class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-03". 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: - api_version: str = kwargs.pop("api_version", "2024-04-03") + api_version: str = kwargs.pop("api_version", "2024-08-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 459f270b399e..4bb4f28819fa 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 @@ -19,12 +19,15 @@ from .._serialization import Deserializer, Serializer from ._configuration import DesktopVirtualizationMgmtClientConfiguration from .operations import ( + ActiveSessionHostConfigurationsOperations, AppAttachPackageInfoOperations, AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -33,6 +36,9 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -40,66 +46,86 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """DesktopVirtualizationMgmtClient. +class DesktopVirtualizationMgmtClient: # pylint: disable=too-many-instance-attributes + """This Typespec represents the Desktop Virtualization API interfaces. :ivar operations: Operations operations :vartype operations: azure.mgmt.desktopvirtualization.aio.operations.Operations + :ivar app_attach_package: AppAttachPackageOperations operations + :vartype app_attach_package: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageOperations + :ivar application_groups: ApplicationGroupsOperations operations + :vartype application_groups: + azure.mgmt.desktopvirtualization.aio.operations.ApplicationGroupsOperations + :ivar host_pools: HostPoolsOperations operations + :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations + :ivar scaling_plans: ScalingPlansOperations operations + :vartype scaling_plans: azure.mgmt.desktopvirtualization.aio.operations.ScalingPlansOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.desktopvirtualization.aio.operations.WorkspacesOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: azure.mgmt.desktopvirtualization.aio.operations.ApplicationsOperations + :ivar desktops: DesktopsOperations operations + :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations + :ivar start_menu_items: StartMenuItemsOperations operations + :vartype start_menu_items: + azure.mgmt.desktopvirtualization.aio.operations.StartMenuItemsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.ActiveSessionHostConfigurationsOperations + :ivar msix_images: MsixImagesOperations operations + :vartype msix_images: azure.mgmt.desktopvirtualization.aio.operations.MsixImagesOperations + :ivar app_attach_package_info: AppAttachPackageInfoOperations operations + :vartype app_attach_package_info: + azure.mgmt.desktopvirtualization.aio.operations.AppAttachPackageInfoOperations + :ivar msix_packages: MSIXPackagesOperations operations + :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.desktopvirtualization.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.desktopvirtualization.aio.operations.PrivateLinkResourcesOperations - :ivar scaling_plans: ScalingPlansOperations operations - :vartype scaling_plans: azure.mgmt.desktopvirtualization.aio.operations.ScalingPlansOperations - :ivar scaling_plan_pooled_schedules: ScalingPlanPooledSchedulesOperations operations - :vartype scaling_plan_pooled_schedules: - azure.mgmt.desktopvirtualization.aio.operations.ScalingPlanPooledSchedulesOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostConfigurationsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.ControlSessionHostUpdateOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.InitiateSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_hosts: SessionHostsOperations operations + :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations + :ivar user_sessions: UserSessionsOperations operations + :vartype user_sessions: azure.mgmt.desktopvirtualization.aio.operations.UserSessionsOperations :ivar scaling_plan_personal_schedules: ScalingPlanPersonalSchedulesOperations operations :vartype scaling_plan_personal_schedules: azure.mgmt.desktopvirtualization.aio.operations.ScalingPlanPersonalSchedulesOperations - :ivar application_groups: ApplicationGroupsOperations operations - :vartype application_groups: - azure.mgmt.desktopvirtualization.aio.operations.ApplicationGroupsOperations - :ivar start_menu_items: StartMenuItemsOperations operations - :vartype start_menu_items: - azure.mgmt.desktopvirtualization.aio.operations.StartMenuItemsOperations - :ivar applications: ApplicationsOperations operations - :vartype applications: azure.mgmt.desktopvirtualization.aio.operations.ApplicationsOperations - :ivar desktops: DesktopsOperations operations - :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations - :ivar host_pools: HostPoolsOperations operations - :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations - :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 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 + :ivar scaling_plan_pooled_schedules: ScalingPlanPooledSchedulesOperations operations + :vartype scaling_plan_pooled_schedules: + azure.mgmt.desktopvirtualization.aio.operations.ScalingPlanPooledSchedulesOperations :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. 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 "2024-04-03". 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__( @@ -137,35 +163,53 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package = AppAttachPackageOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.application_groups = ApplicationGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.app_attach_package_info = AppAttachPackageInfoOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) - self.scaling_plan_pooled_schedules = ScalingPlanPooledSchedulesOperations( + self.session_host_configurations = SessionHostConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.scaling_plan_personal_schedules = ScalingPlanPersonalSchedulesOperations( + self.session_host_managements = SessionHostManagementsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.application_groups = ApplicationGroupsOperations( + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) - 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.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) self.session_hosts = SessionHostsOperations(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.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plan_personal_schedules = ScalingPlanPersonalSchedulesOperations( 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.scaling_plan_pooled_schedules = ScalingPlanPooledSchedulesOperations( self._client, self._config, self._serialize, self._deserialize ) 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 df927dd95440..2847416f8466 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 @@ -5,49 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._scaling_plans_operations import ScalingPlansOperations -from ._scaling_plan_pooled_schedules_operations import ScalingPlanPooledSchedulesOperations -from ._scaling_plan_personal_schedules_operations import ScalingPlanPersonalSchedulesOperations -from ._application_groups_operations import ApplicationGroupsOperations -from ._start_menu_items_operations import StartMenuItemsOperations -from ._applications_operations import ApplicationsOperations -from ._desktops_operations import DesktopsOperations -from ._host_pools_operations import HostPoolsOperations -from ._user_sessions_operations import UserSessionsOperations -from ._session_hosts_operations import SessionHostsOperations -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._app_attach_package_operations import AppAttachPackageOperations # type: ignore +from ._application_groups_operations import ApplicationGroupsOperations # type: ignore +from ._host_pools_operations import HostPoolsOperations # type: ignore +from ._scaling_plans_operations import ScalingPlansOperations # type: ignore +from ._workspaces_operations import WorkspacesOperations # type: ignore +from ._applications_operations import ApplicationsOperations # type: ignore +from ._desktops_operations import DesktopsOperations # type: ignore +from ._start_menu_items_operations import StartMenuItemsOperations # type: ignore +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations # type: ignore +from ._msix_images_operations import MsixImagesOperations # type: ignore +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations # type: ignore +from ._msix_packages_operations import MSIXPackagesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._session_host_configurations_operations import SessionHostConfigurationsOperations # type: ignore +from ._session_host_managements_operations import SessionHostManagementsOperations # type: ignore +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations # type: ignore +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations # type: ignore +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations # type: ignore +from ._session_hosts_operations import SessionHostsOperations # type: ignore +from ._user_sessions_operations import UserSessionsOperations # type: ignore +from ._scaling_plan_personal_schedules_operations import ScalingPlanPersonalSchedulesOperations # type: ignore +from ._scaling_plan_pooled_schedules_operations import ScalingPlanPooledSchedulesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", - "WorkspacesOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "ScalingPlansOperations", - "ScalingPlanPooledSchedulesOperations", - "ScalingPlanPersonalSchedulesOperations", + "AppAttachPackageOperations", "ApplicationGroupsOperations", - "StartMenuItemsOperations", + "HostPoolsOperations", + "ScalingPlansOperations", + "WorkspacesOperations", "ApplicationsOperations", "DesktopsOperations", - "HostPoolsOperations", - "UserSessionsOperations", - "SessionHostsOperations", - "MSIXPackagesOperations", - "AppAttachPackageInfoOperations", + "StartMenuItemsOperations", + "ActiveSessionHostConfigurationsOperations", "MsixImagesOperations", - "AppAttachPackageOperations", + "AppAttachPackageInfoOperations", + "MSIXPackagesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "SessionHostConfigurationsOperations", + "SessionHostManagementsOperations", + "ControlSessionHostUpdateOperations", + "InitiateSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostsOperations", + "UserSessionsOperations", + "ScalingPlanPersonalSchedulesOperations", + "ScalingPlanPooledSchedulesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/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..cbd5a3125e9b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,204 @@ +# 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, 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 +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 + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ActiveSessionHostConfiguration"]: + # pylint: disable=line-too-long + """Operation to list the ActiveSessionHostConfigurations 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: 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 = { + 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) + 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_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get a ActiveSessionHostConfiguration. + + :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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", 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/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_info_operations.py index 508d45e2de01..efd57e12f467 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +60,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: _models.ImportPackageInfoRequest, + import_package_info_request: Optional[_models.ImportPackageInfoRequest] = None, *, content_type: str = "application/json", **kwargs: Any @@ -73,8 +72,7 @@ def import_method( :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. + :param import_package_info_request: Default value is None. :type import_package_info_request: ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -91,7 +89,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: IO[bytes], + import_package_info_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -103,8 +101,7 @@ def import_method( :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. + :param import_package_info_request: Default value is None. :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". @@ -120,7 +117,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + import_package_info_request: Optional[Union[_models.ImportPackageInfoRequest, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterable["_models.AppAttachPackage"]: """Gets information from a package given the path to the package. @@ -130,8 +127,8 @@ def import_method( :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. + :param import_package_info_request: Is either a ImportPackageInfoRequest type or a IO[bytes] + type. Default value is None. :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) @@ -146,7 +143,7 @@ def import_method( 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +156,10 @@ def import_method( if isinstance(import_package_info_request, (IOBase, bytes)): _content = import_package_info_request else: - _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + if import_package_info_request is not None: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + else: + _json = None def prepare_request(next_link=None): if not next_link: 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 index e15d1700b12f..12414c00bd35 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +63,174 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_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, host + pool, and resource group. 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 = { + 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) + + @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 and + host pool. 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 = { + 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_async async def get( self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any @@ -79,7 +246,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +366,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,60 +421,6 @@ async def create_or_update( 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, **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. Required. - :type app_attach_package_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_delete_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, 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, @@ -325,8 +438,7 @@ async def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Default value - is None. + :param app_attach_package_patch: The resource properties to be updated. 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". @@ -353,8 +465,7 @@ async def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Default value - is None. + :param app_attach_package_patch: The resource properties to be updated. 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". @@ -379,7 +490,7 @@ async def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + :param app_attach_package_patch: The resource properties to be updated. 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] @@ -387,7 +498,7 @@ async def update( :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,30 +556,24 @@ async def update( 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. + @distributed_trace_async + async def delete( + 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 filter: OData filter expression. Valid properties for filtering are package name and - host pool. 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] + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param force: Allows force delete. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -476,139 +581,34 @@ def list_by_resource_group( } 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, host - pool, and resource group. 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) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 85b9c639ab72..9f4f14bb1fe7 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +63,189 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_by_subscription( + self, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGroup"]: + """List applicationGroups in subscription. + + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. Default value is None. + :type filter: str + :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] + :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.ApplicationGroupList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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("ApplicationGroupList", 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_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGroup"]: + """List applicationGroups. + + :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 + applicationGroupType. Default value is None. + :type filter: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.ApplicationGroupList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ApplicationGroupList", 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_async async def get( self, resource_group_name: str, application_group_name: str, **kwargs: Any @@ -79,7 +261,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +294,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -197,7 +380,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +425,8 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -251,59 +435,6 @@ async def create_or_update( return deserialized # type: ignore - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, application_group_name: str, **kwargs: Any - ) -> None: - """Remove an applicationGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_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_delete_request( - resource_group_name=resource_group_name, - application_group_name=application_group_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, 204]: - 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 - @overload async def update( self, @@ -321,8 +452,7 @@ async def update( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. Default value is - None. + :param application_group: The AppGroup properties to be updated. Default value is None. :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -349,8 +479,7 @@ async def update( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. Default value is - None. + :param application_group: The AppGroup properties to be updated. Default value is None. :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -375,7 +504,7 @@ async def update( :type resource_group_name: str :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 + :param application_group: The AppGroup properties to be updated. Is either a ApplicationGroupPatch type or a IO[bytes] type. Default value is None. :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or IO[bytes] @@ -383,7 +512,7 @@ async def update( :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +560,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -440,42 +570,20 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - filter: Optional[str] = None, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ApplicationGroup"]: - """List applicationGroups. + @distributed_trace_async + async def delete(self, resource_group_name: str, application_group_name: str, **kwargs: Any) -> None: + """Remove an applicationGroup. :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 - applicationGroupType. Default value is None. - :type filter: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,140 +591,33 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ApplicationGroupList", 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) - - @distributed_trace - def list_by_subscription( - self, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationGroup"]: - """List applicationGroups in subscription. - - :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. Default value is None. - :type filter: str - :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] - :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.ApplicationGroupList] = 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("ApplicationGroupList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 d21375e40c45..79180a14d9e0 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +62,106 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + application_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Application"]: + """List applications. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.ApplicationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + application_group_name=application_group_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ApplicationList", 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_async async def get( self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -81,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +214,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -212,7 +312,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +358,8 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -267,63 +368,6 @@ async def create_or_update( return deserialized # type: ignore - @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 - ) -> None: - """Remove an application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_name: str - :param application_name: The name of the application within the specified application group. - Required. - :type application_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload async def update( self, @@ -345,7 +389,7 @@ async def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Default value is None. + :param application: The resource properties to be updated. Default value is None. :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -376,7 +420,7 @@ async def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Default value is None. + :param application: The resource properties to be updated. Default value is None. :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -405,14 +449,14 @@ async def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO[bytes] type. Default value is None. + :param application: The resource properties to be updated. Is either a ApplicationPatch 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +505,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -470,41 +515,25 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list( - self, - resource_group_name: str, - application_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Application"]: - """List applications. + @distributed_trace_async + async def delete( + self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any + ) -> None: + """Remove an application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param application_name: The name of the application within the specified application group. + Required. + :type application_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,59 +541,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - application_group_name=application_group_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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..52a2e31b1683 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py @@ -0,0 +1,252 @@ +# 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, 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 +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 = { + 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 actions on a session host update. + + :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: The content of the action request. 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 actions on a session host update. + + :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: The content of the action request. 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 actions on a session host update. + + :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: The content of the action request. 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 fb1790ae3681..0c72ed262150 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,7 +32,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,6 +56,106 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + application_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Desktop"]: + """List desktops. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.DesktopList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + application_group_name=application_group_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("DesktopList", 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_async async def get( self, resource_group_name: str, application_group_name: str, desktop_name: str, **kwargs: Any @@ -74,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +207,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Desktop", pipeline_response.http_response) @@ -137,7 +237,7 @@ 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. Default value is None. + :param desktop: The resource properties to be updated. Default value is None. :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -167,7 +267,7 @@ 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. Default value is None. + :param desktop: The resource properties to be updated. Default value is None. :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -195,14 +295,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 + :param desktop: The resource properties to be updated. 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -251,7 +351,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Desktop", pipeline_response.http_response) @@ -259,102 +360,3 @@ async def update( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - application_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Desktop"]: - """List desktops. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] - :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.DesktopList] = 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_request( - resource_group_name=resource_group_name, - application_group_name=application_group_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("DesktopList", 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/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py index 6c02ad1f5973..69816435ac98 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,6 +65,193 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.HostPool"]: + """List hostPools in subscription. + + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.HostPoolList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("HostPoolList", 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_resource_group( + self, + resource_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.HostPool"]: + """List hostPools. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.HostPoolList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("HostPoolList", 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_async async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.HostPool: """Get a host pool. @@ -79,7 +265,7 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +298,8 @@ async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HostPool", pipeline_response.http_response) @@ -197,7 +384,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +429,8 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HostPool", pipeline_response.http_response) @@ -251,62 +439,6 @@ async def create_or_update( return deserialized # type: ignore - @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 - ) -> None: - """Remove a host pool. - - :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 force: Force flag to delete sessionHost. 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, - host_pool_name=host_pool_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload async def update( self, @@ -324,7 +456,7 @@ async def 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. Default value is None. + :param host_pool: The properties to be updated. Default value is None. :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -351,7 +483,7 @@ async def 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. Default value is None. + :param host_pool: The properties to be updated. Default value is None. :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -376,14 +508,14 @@ async def 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 HostPoolPatch type or a - IO[bytes] type. Default value is None. + :param host_pool: The properties to be updated. Is either a HostPoolPatch type or a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +563,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HostPool", pipeline_response.http_response) @@ -440,38 +573,24 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.HostPool"]: - """List hostPools. + @distributed_trace_async + async def delete( + self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param force: Force flag to delete sessionHost. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,168 +598,54 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("HostPoolList", 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) - - @distributed_trace - def list( - self, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.HostPool"]: - """List hostPools in subscription. - - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] - :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.HostPoolList] = 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_request( - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("HostPoolList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def retrieve_registration_token( + async def list_registration_tokens( self, resource_group_name: str, host_pool_name: str, **kwargs: Any - ) -> _models.RegistrationInfo: - """Registration token of the host pool. + ) -> _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: RegistrationInfo or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,9 +657,9 @@ async def retrieve_registration_token( _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.RegistrationInfo] = kwargs.pop("cls", None) + cls: ClsType[_models.RegistrationTokenList] = kwargs.pop("cls", None) - _request = build_retrieve_registration_token_request( + _request = build_list_registration_tokens_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -673,9 +678,10 @@ async def retrieve_registration_token( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) + deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,21 +689,21 @@ async def retrieve_registration_token( return deserialized # type: ignore @distributed_trace_async - async def list_registration_tokens( + async def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any - ) -> _models.RegistrationTokenList: - """Operation to list the RegistrationTokens associated with the HostPool. + ) -> _models.RegistrationInfo: + """Registration token of the host pool. :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 + :return: RegistrationInfo or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,9 +715,9 @@ async def list_registration_tokens( _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) + cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - _request = build_list_registration_tokens_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, @@ -730,9 +736,10 @@ async def list_registration_tokens( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) + deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, 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..4ecf8093590c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,188 @@ +# 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, 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 +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( + 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: The resource properties to be updated. 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( + 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: The resource properties to be updated. 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( + 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: The resource properties to be updated. 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 = { + 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 [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 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 e773c50662e3..f0183125c41d 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,19 +60,20 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: _models.MSIXImageURI, + msix_image_uri: Optional[_models.MSIXImageURI] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncIterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Required. + :param msix_image_uri: Default value is None. :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -89,19 +89,20 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO[bytes], + msix_image_uri: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncIterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Required. + :param msix_image_uri: Default value is None. :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -117,18 +118,19 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], + msix_image_uri: Optional[Union[_models.MSIXImageURI, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO[bytes] type. Required. + :param msix_image_uri: Is either a MSIXImageURI type or a IO[bytes] type. Default value is + None. :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: @@ -142,7 +144,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +157,10 @@ def expand( if isinstance(msix_image_uri, (IOBase, bytes)): _content = msix_image_uri else: - _json = self._serialize.body(msix_image_uri, "MSIXImageURI") + if msix_image_uri is not None: + _json = self._serialize.body(msix_image_uri, "MSIXImageURI") + else: + _json = None def prepare_request(next_link=None): if not next_link: @@ -208,7 +213,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 600fd5c5dc8d..f7df5be2dd09 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +62,106 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.MSIXPackage"]: + """List MSIX packages in 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 page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.MSIXPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("MSIXPackageList", 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_async async def get( self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -81,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +214,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -212,7 +312,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +358,8 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -267,70 +368,13 @@ async def create_or_update( return deserialized # type: ignore - @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 - ) -> None: - """Remove an MSIX 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 msix_package_full_name: The version specific package full name of the MSIX package - within specified hostpool. Required. - :type msix_package_full_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload async def update( self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[_models.MSIXPackagePatch] = None, + msix_package: _models.MSIXPackagePatch, *, content_type: str = "application/json", **kwargs: Any @@ -345,7 +389,7 @@ async def update( :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 - :param msix_package: Object containing MSIX Package definitions. Default value is None. + :param msix_package: The resource properties to be updated. Required. :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -361,7 +405,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO[bytes]] = None, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,7 +420,7 @@ async def update( :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 - :param msix_package: Object containing MSIX Package definitions. Default value is None. + :param msix_package: The resource properties to be updated. Required. :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -392,7 +436,7 @@ async def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, + msix_package: Union[_models.MSIXPackagePatch, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -405,14 +449,14 @@ async def update( :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 - :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO[bytes] type. Default value is None. + :param msix_package: The resource properties to be updated. Is either a MSIXPackagePatch type + or a IO[bytes] type. Required. :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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,10 +477,7 @@ async def update( if isinstance(msix_package, (IOBase, bytes)): _content = msix_package else: - if msix_package is not None: - _json = self._serialize.body(msix_package, "MSIXPackagePatch") - else: - _json = None + _json = self._serialize.body(msix_package, "MSIXPackagePatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -461,7 +502,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -470,41 +512,25 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.MSIXPackage"]: - """List MSIX packages in hostpool. + @distributed_trace_async + async def delete( + self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any + ) -> None: + """Remove an MSIX 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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :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 + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MSIXPackageList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,59 +538,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - host_pool_name=host_pool_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("MSIXPackageList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 c48bca8240e1..122126798382 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +56,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: - """List all of the available operations the Desktop Virtualization resource provider supports. + """List the operations for the provider. :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) @@ -69,9 +68,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio _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.ResourceProviderOperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceProviderOperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +106,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -124,7 +123,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 1a2a1c1208c8..d5453cc76131 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,16 +66,29 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_workspace( - self, resource_group_name: str, workspace_name: str, **kwargs: Any + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionWithSystemData"]: - """List private endpoint connections. + # pylint: disable=line-too-long + """Get a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -89,7 +101,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,10 +112,13 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_workspace_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, api_version=api_version, headers=_headers, params=_params, @@ -145,31 +160,31 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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_async - async def get_by_workspace( - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def get_by_host_pool( + self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Get a private endpoint connection. + """Get a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,9 +198,9 @@ 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_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, @@ -203,7 +218,8 @@ async def get_by_workspace( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -212,86 +228,29 @@ async def get_by_workspace( return deserialized # type: ignore - @distributed_trace_async - async def delete_by_workspace( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Remove a connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload - async def update_by_workspace( + async def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, - connection: _models.PrivateEndpointConnection, + connection: _models.PrivateEndpointConnectionWithSystemData, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection + :param connection: Resource create parameters. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -301,27 +260,26 @@ async def update_by_workspace( """ @overload - async def update_by_workspace( + async def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. + :param connection: Resource create parameters. Required. :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -332,33 +290,32 @@ async def update_by_workspace( """ @distributed_trace_async - async def update_by_workspace( + async def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO[bytes]], + connection: Union[_models.PrivateEndpointConnectionWithSystemData, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or - IO[bytes] + :param connection: Resource create parameters. Is either a + PrivateEndpointConnectionWithSystemData type or a IO[bytes] type. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData or IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,11 +336,11 @@ async def update_by_workspace( if isinstance(connection, (IOBase, bytes)): _content = connection else: - _json = self._serialize.body(connection, "PrivateEndpointConnection") + _json = self._serialize.body(connection, "PrivateEndpointConnectionWithSystemData") - _request = build_update_by_workspace_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, @@ -402,9 +359,10 @@ async def update_by_workspace( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -413,29 +371,75 @@ async def update_by_workspace( return deserialized # type: ignore - @distributed_trace - def list_by_host_pool( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionWithSystemData"]: - """List private endpoint connections associated with hostpool. + @distributed_trace_async + async def delete_by_host_pool( + self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnectionWithSystemData. :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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _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_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, + 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 + + @distributed_trace + def list_by_workspace( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionWithSystemData"]: + # pylint: disable=line-too-long + """Get a PrivateEndpointConnectionWithSystemData. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -448,7 +452,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,13 +463,10 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, api_version=api_version, headers=_headers, params=_params, @@ -507,31 +508,31 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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_async - async def get_by_host_pool( - self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def get_by_workspace( + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Get a private endpoint connection. + """Get a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -545,9 +546,9 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -565,7 +566,8 @@ async def get_by_host_pool( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -574,86 +576,29 @@ async def get_by_host_pool( return deserialized # type: ignore - @distributed_trace_async - async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Remove a connection. - - :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload - async def update_by_host_pool( + async def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, - connection: _models.PrivateEndpointConnection, + connection: _models.PrivateEndpointConnectionWithSystemData, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection + :param connection: Resource create parameters. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -663,27 +608,26 @@ async def update_by_host_pool( """ @overload - async def update_by_host_pool( + async def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. + :param connection: Resource create parameters. Required. :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -694,33 +638,32 @@ async def update_by_host_pool( """ @distributed_trace_async - async def update_by_host_pool( + async def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO[bytes]], + connection: Union[_models.PrivateEndpointConnectionWithSystemData, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or - IO[bytes] + :param connection: Resource create parameters. Is either a + PrivateEndpointConnectionWithSystemData type or a IO[bytes] type. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData or IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -741,11 +684,11 @@ async def update_by_host_pool( if isinstance(connection, (IOBase, bytes)): _content = connection else: - _json = self._serialize.body(connection, "PrivateEndpointConnection") + _json = self._serialize.body(connection, "PrivateEndpointConnectionWithSystemData") - _request = build_update_by_host_pool_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -764,9 +707,10 @@ async def update_by_host_pool( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -774,3 +718,60 @@ async def update_by_host_pool( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @distributed_trace_async + async def delete_by_workspace( + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnectionWithSystemData. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _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_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, + 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 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 f47e7e19d506..e6636292e0c1 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,22 +58,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_workspace( + def list_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResource"]: - """List the private link resources available for this workspace. + """List the private link resources available for this hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -92,7 +91,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,9 +102,9 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_workspace_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_name, + host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, @@ -151,29 +150,30 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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_host_pool( + def list_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResource"]: - """List the private link resources available for this hostpool. + """List the private link resources available for this workspace. :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 workspace_name: The name of the workspace. Required. + :type workspace_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -191,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,9 +202,9 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, @@ -250,7 +250,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 621c61afe6ed..32362ecdf741 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +62,107 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + scaling_plan_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlanPersonalSchedule"]: + """List ScalingPlanPersonalSchedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] + :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.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanPersonalScheduleList", 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_async async def get( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -80,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +214,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -212,7 +313,7 @@ async def create( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +359,8 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -267,69 +369,13 @@ async def create( return deserialized # type: ignore - @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 - ) -> None: - """Remove a ScalingPlanPersonalSchedule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. - :type scaling_plan_schedule_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload async def update( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[_models.ScalingPlanPersonalSchedulePatch] = None, + scaling_plan_personal_schedule: Optional[_models.ScalingPlanPersonalSchedulePatch] = None, *, content_type: str = "application/json", **kwargs: Any @@ -343,9 +389,9 @@ async def update( :type scaling_plan_name: str :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. - Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_personal_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_personal_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -361,7 +407,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO[bytes]] = None, + scaling_plan_personal_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -375,9 +421,9 @@ async def update( :type scaling_plan_name: str :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. - Default value is None. - :type scaling_plan_schedule: IO[bytes] + :param scaling_plan_personal_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_personal_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 @@ -392,7 +438,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[bytes]]] = None, + scaling_plan_personal_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -404,15 +450,15 @@ async def update( :type scaling_plan_name: str :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[bytes] type. Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_personal_schedule: The resource properties to be updated. Is either a + ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. + :type scaling_plan_personal_schedule: ~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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,11 +476,11 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(scaling_plan_schedule, (IOBase, bytes)): - _content = scaling_plan_schedule + if isinstance(scaling_plan_personal_schedule, (IOBase, bytes)): + _content = scaling_plan_personal_schedule else: - if scaling_plan_schedule is not None: - _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedulePatch") + if scaling_plan_personal_schedule is not None: + _json = self._serialize.body(scaling_plan_personal_schedule, "ScalingPlanPersonalSchedulePatch") else: _json = None @@ -461,7 +507,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -470,42 +517,24 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list( - self, - resource_group_name: str, - scaling_plan_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ScalingPlanPersonalSchedule"]: - """List ScalingPlanPersonalSchedules. + @distributed_trace_async + async def delete( + self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any + ) -> None: + """Remove a ScalingPlanPersonalSchedule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] + :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. + :type scaling_plan_schedule_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,59 +542,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanPersonalScheduleList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 4f2c8e715a3c..63ea29fdbbc6 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +62,107 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + scaling_plan_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlanPooledSchedule"]: + """List ScalingPlanPooledSchedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] + :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.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanPooledScheduleList", 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_async async def get( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -80,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +214,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -211,7 +312,7 @@ async def create( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +358,8 @@ async def create( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -266,69 +368,13 @@ async def create( return deserialized # type: ignore - @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 - ) -> None: - """Remove a ScalingPlanPooledSchedule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. - :type scaling_plan_schedule_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload async def update( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[_models.ScalingPlanPooledSchedulePatch] = None, + scaling_plan_pooled_schedule: Optional[_models.ScalingPlanPooledSchedulePatch] = None, *, content_type: str = "application/json", **kwargs: Any @@ -342,9 +388,9 @@ async def update( :type scaling_plan_name: str :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. Default - value is None. - :type scaling_plan_schedule: + :param scaling_plan_pooled_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_pooled_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -360,7 +406,7 @@ async def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO[bytes]] = None, + scaling_plan_pooled_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -374,9 +420,9 @@ async def update( :type scaling_plan_name: str :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. Default - value is None. - :type scaling_plan_schedule: IO[bytes] + :param scaling_plan_pooled_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_pooled_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 @@ -391,7 +437,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[bytes]]] = None, + scaling_plan_pooled_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -403,15 +449,15 @@ async def update( :type scaling_plan_name: str :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[bytes] type. Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_pooled_schedule: The resource properties to be updated. Is either a + ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. + :type scaling_plan_pooled_schedule: ~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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,11 +475,11 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(scaling_plan_schedule, (IOBase, bytes)): - _content = scaling_plan_schedule + if isinstance(scaling_plan_pooled_schedule, (IOBase, bytes)): + _content = scaling_plan_pooled_schedule else: - if scaling_plan_schedule is not None: - _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedulePatch") + if scaling_plan_pooled_schedule is not None: + _json = self._serialize.body(scaling_plan_pooled_schedule, "ScalingPlanPooledSchedulePatch") else: _json = None @@ -460,7 +506,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -469,42 +516,24 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list( - self, - resource_group_name: str, - scaling_plan_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ScalingPlanPooledSchedule"]: - """List ScalingPlanPooledSchedules. + @distributed_trace_async + async def delete( + self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any + ) -> None: + """Remove a ScalingPlanPooledSchedule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] + :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. + :type scaling_plan_schedule_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,59 +541,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanPooledScheduleList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 1cdf85e4fd44..7c81391430b2 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,20 +64,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) -> _models.ScalingPlan: - """Get a scaling plan. + @distributed_trace + def list_by_subscription( + self, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlan"]: + """List scaling plans in subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :return: ScalingPlan or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[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.ScalingPlanList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,117 +99,194 @@ async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _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, - 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 - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("ScalingPlanList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("ScalingPlan", 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, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @overload - async def create( + @distributed_trace + def list_by_host_pool( self, resource_group_name: str, - scaling_plan_name: str, - scaling_plan: _models.ScalingPlan, - *, - content_type: str = "application/json", + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, **kwargs: Any - ) -> _models.ScalingPlan: - """Create or update a scaling plan. + ) -> AsyncIterable["_models.ScalingPlan"]: + """List scaling plan associated with hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :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: ~azure.mgmt.desktopvirtualization.models.ScalingPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ScalingPlan or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def create( - self, - resource_group_name: str, - scaling_plan_name: str, - scaling_plan: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ScalingPlan: - """Create or update a scaling plan. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ScalingPlan or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def create( + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanList", 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_resource_group( self, resource_group_name: str, - scaling_plan_name: str, - scaling_plan: Union[_models.ScalingPlan, IO[bytes]], + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, **kwargs: Any - ) -> _models.ScalingPlan: - """Create or update a scaling plan. + ) -> AsyncIterable["_models.ScalingPlan"]: + """List scaling plans. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :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[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 + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[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.ScalingPlanList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,68 +294,77 @@ async def create( } 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.ScalingPlan] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(scaling_plan, (IOBase, bytes)): - _content = scaling_plan - else: - _json = self._serialize.body(scaling_plan, "ScalingPlan") + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_create_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_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 - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("ScalingPlanList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("ScalingPlan", 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, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any - ) -> None: - """Remove a scaling plan. + async def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) -> _models.ScalingPlan: + """Get a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :return: None or the result of cls(response) - :rtype: None + :return: ScalingPlan or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,9 +376,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[_models.ScalingPlan] = kwargs.pop("cls", None) - _request = build_delete_request( + _request = build_get_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -296,32 +395,37 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - async def update( + async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[_models.ScalingPlanPatch] = None, + scaling_plan: _models.ScalingPlan, *, content_type: str = "application/json", **kwargs: Any ) -> _models.ScalingPlan: - """Update a scaling plan. + """Create or update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :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: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch + :param scaling_plan: Object containing scaling plan definitions. Required. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -331,23 +435,23 @@ async def update( """ @overload - async def update( + async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[IO[bytes]] = None, + scaling_plan: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ScalingPlan: - """Update a scaling plan. + """Create or update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :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. + :param scaling_plan: Object containing scaling plan definitions. Required. :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -358,28 +462,28 @@ async def update( """ @distributed_trace_async - async def update( + async def create( self, resource_group_name: str, scaling_plan_name: str, - scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, + scaling_plan: Union[_models.ScalingPlan, IO[bytes]], **kwargs: Any ) -> _models.ScalingPlan: - """Update a scaling plan. + """Create or update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :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[bytes] type. Default value is None. - :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch or IO[bytes] + :param scaling_plan: Object containing scaling plan definitions. Is either a ScalingPlan type + 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,12 +504,9 @@ async def update( if isinstance(scaling_plan, (IOBase, bytes)): _content = scaling_plan else: - if scaling_plan is not None: - _json = self._serialize.body(scaling_plan, "ScalingPlanPatch") - else: - _json = None + _json = self._serialize.body(scaling_plan, "ScalingPlan") - _request = build_update_request( + _request = build_create_request( resource_group_name=resource_group_name, scaling_plan_name=scaling_plan_name, subscription_id=self._config.subscription_id, @@ -425,9 +526,10 @@ async def update( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) @@ -436,129 +538,83 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( + @overload + async def update( self, resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, + scaling_plan_name: str, + scaling_plan: Optional[_models.ScalingPlanPatch] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.ScalingPlan"]: - """List scaling plans. + ) -> _models.ScalingPlan: + """Update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] - :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.ScalingPlanList] = 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ScalingPlanList", 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) + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param scaling_plan: The resource properties to be updated. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ScalingPlan or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def list_by_subscription( + @overload + async def update( self, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.ScalingPlan"]: - """List scaling plans in subscription. + ) -> _models.ScalingPlan: + """Update a scaling plan. - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param scaling_plan: The resource properties to be updated. Default value is None. + :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 + :return: ScalingPlan or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :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.ScalingPlanList] = kwargs.pop("cls", None) + @distributed_trace_async + async def update( + self, + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: Optional[Union[_models.ScalingPlanPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ScalingPlan: + """Update a scaling plan. - error_map: MutableMapping[int, Type[HttpResponseError]] = { + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param scaling_plan: The resource properties to be updated. Is either a ScalingPlanPatch 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: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,96 +622,70 @@ def list_by_subscription( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + 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.ScalingPlan] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(scaling_plan, (IOBase, bytes)): + _content = scaling_plan + else: + if scaling_plan is not None: + _json = self._serialize.body(scaling_plan, "ScalingPlanPatch") 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 + _json = None - async def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanList", 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) + _request = build_update_request( + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_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) - 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 + ) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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 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 + deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace - def list_by_host_pool( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ScalingPlan"]: - """List scaling plan associated with hostpool. + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) -> None: + """Remove a scaling plan. :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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -663,59 +693,33 @@ def list_by_host_pool( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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..28efb0b2b03c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py @@ -0,0 +1,628 @@ +# 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, 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 +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") + + @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 = { + 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) + 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_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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + 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 = { + 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 = {} + if response.status_code == 201: + 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_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: Resource create parameters. 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: Resource create parameters. 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: Resource create parameters. 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): + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # 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 = { + 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.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: The resource properties to be updated. 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: The resource properties to be updated. 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: The resource properties to be updated. 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): + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # 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 + ) 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..17ccae1c8045 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py @@ -0,0 +1,472 @@ +# 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, 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 +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 + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostManagement"]: + """List SessionHostManagements. + + :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 = { + 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) + 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_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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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: Resource create parameters. 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: Resource create parameters. 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: Resource create parameters. 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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: The properties to be updated. 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: The properties to be updated. 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: The properties to be updated. 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", 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_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..b9f4c4931742 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.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 sys +from typing import Any, Callable, Dict, Optional, 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 +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 a SessionHostManagementUpdateStatus. + + :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 = { + 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_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py index 55d5d6e8fbf5..840f7250a33f 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,13 +31,14 @@ build_delete_request, build_get_request, build_list_request, + build_retry_provisioning_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 + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,25 +62,44 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any - ) -> _models.SessionHost: - """Get a session host. + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + 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. :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: SessionHost or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[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.SessionHostList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,51 +107,70 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _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, - 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 - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("SessionHost", 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, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - host_pool_name: str, - session_host_name: str, - force: Optional[bool] = None, - **kwargs: Any - ) -> None: - """Remove a SessionHost. + async def get( + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> _models.SessionHost: + """Get a session host. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -142,14 +180,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :param force: Force flag to force sessionHost deletion even when userSession exists. Default - value is None. - :type force: bool - :return: None or the result of cls(response) - :rtype: None + :return: SessionHost or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,14 +196,13 @@ async def delete( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - _request = build_delete_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, - force=force, api_version=api_version, headers=_headers, params=_params, @@ -182,12 +216,17 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def update( @@ -214,7 +253,7 @@ async def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Default value is None. + :param session_host: The resource properties to be updated. Default value is None. :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -249,7 +288,7 @@ async def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Default value is None. + :param session_host: The resource properties to be updated. Default value is None. :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -282,14 +321,14 @@ async def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO[bytes] type. Default value is None. + :param session_host: The resource properties to be updated. Is either a SessionHostPatch 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +378,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SessionHost", pipeline_response.http_response) @@ -348,41 +388,92 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list( + @distributed_trace_async + async def delete( self, resource_group_name: str, host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, + session_host_name: str, + force: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterable["_models.SessionHost"]: - """List sessionHosts. + ) -> None: + """Remove 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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :param force: Force flag to force sessionHost deletion even when userSession exists. 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 = { + 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.SessionHostList] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + + _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, + 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) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def retry_provisioning( + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """A synchronous resource action that returns no content. + + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,59 +481,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - host_pool_name=host_pool_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - async def extract_data(pipeline_response): - deserialized = self._deserialize("SessionHostList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 ac7671a50014..4e625a9ef211 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +88,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +147,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 05aeae0749fe..eaa09334a483 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,11 +64,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_host_pool( + def list( self, resource_group_name: str, host_pool_name: str, - filter: Optional[str] = None, + session_host_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, @@ -82,9 +81,9 @@ def list_by_host_pool( :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 filter: OData filter expression. Valid properties for filtering are userprincipalname - and sessionstate. Default value is None. - :type filter: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -102,7 +101,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,11 +112,11 @@ 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_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, - filter=filter, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, @@ -162,7 +161,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -189,7 +189,7 @@ async def get( :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +224,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("UserSession", pipeline_response.http_response) @@ -234,7 +235,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, host_pool_name: str, @@ -262,7 +263,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,117 +299,14 @@ async def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - @distributed_trace - def list( - self, - resource_group_name: str, - host_pool_name: str, - session_host_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.UserSession"]: - """List userSessions. - - :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 - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] - :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.UserSessionList] = 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_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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("UserSessionList", 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) - @distributed_trace_async - async def disconnect( # pylint: disable=inconsistent-return-statements + async def disconnect( self, resource_group_name: str, host_pool_name: str, session_host_name: str, user_session_id: str, **kwargs: Any ) -> None: """Disconnect a userSession. @@ -428,7 +326,7 @@ async def disconnect( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,13 +361,14 @@ async def disconnect( # pylint: disable=inconsistent-return-statements 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) + 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 send_message( # pylint: disable=inconsistent-return-statements + async def send_message( self, resource_group_name: str, host_pool_name: str, @@ -493,8 +392,7 @@ async def send_message( # 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 - :param send_message: Object containing message includes title and message body. Default value - is None. + :param send_message: Default value is None. :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -505,7 +403,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements """ @overload - async def send_message( # pylint: disable=inconsistent-return-statements + async def send_message( self, resource_group_name: str, host_pool_name: str, @@ -529,8 +427,7 @@ async def send_message( # 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 - :param send_message: Object containing message includes title and message body. Default value - is None. + :param send_message: Default value is None. :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -541,7 +438,7 @@ async def send_message( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def send_message( # pylint: disable=inconsistent-return-statements + async def send_message( self, resource_group_name: str, host_pool_name: str, @@ -563,14 +460,13 @@ async def send_message( # 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 - :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO[bytes] type. Default value is None. + :param send_message: Is either a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,9 +514,115 @@ async def send_message( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 + + @distributed_trace + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.UserSession"]: + """A synchronous resource action. + + :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 filter: OData filter expression. Valid properties for filtering are userprincipalname + and sessionstate. Default value is None. + :type filter: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.UserSessionList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + filter=filter, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("UserSessionList", 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/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py index c75eaf26869a..8aee6d707223 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +63,178 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: + """List workspaces in subscription. + + :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] + :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.WorkspaceList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkspaceList", 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_resource_group( + self, + resource_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Workspace"]: + """List workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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] + :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.WorkspaceList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("WorkspaceList", 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_async async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Get a workspace. @@ -77,7 +248,7 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +281,8 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -195,7 +367,7 @@ async def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +412,8 @@ async def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -249,59 +422,6 @@ async def create_or_update( return deserialized # type: ignore - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: - """Remove a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_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_delete_request( - resource_group_name=resource_group_name, - workspace_name=workspace_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, 204]: - 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 - @overload async def update( self, @@ -319,7 +439,7 @@ async def 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. Default value is None. + :param workspace: The resource properties to be updated. Default value is None. :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -346,7 +466,7 @@ async def 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. Default value is None. + :param workspace: The resource properties to be updated. Default value is None. :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -371,14 +491,14 @@ async def 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 WorkspacePatch type or a + :param workspace: The resource properties to be updated. Is either a WorkspacePatch type or a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +546,8 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -435,38 +556,20 @@ async def update( return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Workspace"]: - """List workspaces. + @distributed_trace_async + async def delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> None: + """Remove a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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] + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,133 +577,33 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("WorkspaceList", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: - """List workspaces in subscription. - - :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] - :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.WorkspaceList] = 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, - 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("WorkspaceList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 e4e4586e68ad..8f54c6e78259 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 @@ -5,135 +5,209 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import 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 CloudErrorProperties -from ._models_py3 import Desktop -from ._models_py3 import DesktopList -from ._models_py3 import DesktopPatch -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 ImportPackageInfoRequest -from ._models_py3 import LogSpecification -from ._models_py3 import MSIXImageURI -from ._models_py3 import MSIXPackage -from ._models_py3 import MSIXPackageList -from ._models_py3 import MSIXPackagePatch -from ._models_py3 import MaintenanceWindowPatchProperties -from ._models_py3 import MaintenanceWindowProperties -from ._models_py3 import MsixPackageApplications -from ._models_py3 import MsixPackageDependencies -from ._models_py3 import OperationProperties -from ._models_py3 import Plan -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResultWithSystemData -from ._models_py3 import PrivateEndpointConnectionWithSystemData -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -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 -from ._models_py3 import ScalingHostPoolReference -from ._models_py3 import ScalingPlan -from ._models_py3 import ScalingPlanList -from ._models_py3 import ScalingPlanPatch -from ._models_py3 import ScalingPlanPersonalSchedule -from ._models_py3 import ScalingPlanPersonalScheduleList -from ._models_py3 import ScalingPlanPersonalSchedulePatch -from ._models_py3 import ScalingPlanPooledSchedule -from ._models_py3 import ScalingPlanPooledScheduleList -from ._models_py3 import ScalingPlanPooledSchedulePatch -from ._models_py3 import ScalingSchedule -from ._models_py3 import SendMessage -from ._models_py3 import ServiceSpecification -from ._models_py3 import SessionHost -from ._models_py3 import SessionHostHealthCheckFailureDetails -from ._models_py3 import SessionHostHealthCheckReport -from ._models_py3 import SessionHostList -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 UserSession -from ._models_py3 import UserSessionList -from ._models_py3 import Workspace -from ._models_py3 import WorkspaceList -from ._models_py3 import WorkspacePatch +from typing import TYPE_CHECKING -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 FailHealthCheckOnStagingFailure -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 HostpoolPublicNetworkAccess -from ._desktop_virtualization_mgmt_client_enums import LoadBalancerType -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 PublicNetworkAccess -from ._desktop_virtualization_mgmt_client_enums import RegistrationTokenOperation -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 -from ._desktop_virtualization_mgmt_client_enums import SessionState -from ._desktop_virtualization_mgmt_client_enums import SetStartVMOnConnect -from ._desktop_virtualization_mgmt_client_enums import SkuTier -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 UpdateState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ActiveDirectoryInfoPatchProperties, + ActiveDirectoryInfoProperties, + ActiveSessionHostConfiguration, + ActiveSessionHostConfigurationList, + AgentUpdatePatchProperties, + AgentUpdateProperties, + AppAttachPackage, + AppAttachPackageInfoProperties, + AppAttachPackageList, + AppAttachPackagePatch, + AppAttachPackagePatchProperties, + Application, + ApplicationGroup, + ApplicationGroupList, + ApplicationGroupPatch, + ApplicationGroupPatchProperties, + ApplicationList, + ApplicationPatch, + ApplicationPatchProperties, + AzureActiveDirectoryInfoProperties, + BootDiagnosticsInfoPatchProperties, + BootDiagnosticsInfoProperties, + CustomInfoPatchProperties, + CustomInfoProperties, + Desktop, + DesktopList, + DesktopPatch, + DesktopPatchProperties, + DiskInfoPatchProperties, + DiskInfoProperties, + DomainInfoPatchProperties, + DomainInfoProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ExpandMsixImage, + ExpandMsixImageList, + ExpandMsixImageProperties, + HostPool, + HostPoolList, + HostPoolPatch, + HostPoolPatchProperties, + HostPoolUpdateConfigurationPatchProperties, + HostPoolUpdateConfigurationProperties, + HostPoolUpdateControlParameter, + ImageInfoPatchProperties, + ImageInfoProperties, + ImportPackageInfoRequest, + KeyVaultCredentialsPatchProperties, + KeyVaultCredentialsProperties, + LogSpecification, + MSIXImageURI, + MSIXPackage, + MSIXPackageList, + MSIXPackagePatch, + MSIXPackagePatchProperties, + MaintenanceWindowPatchProperties, + MaintenanceWindowProperties, + ManagedServiceIdentity, + MarketplaceInfoPatchProperties, + MarketplaceInfoProperties, + MsixPackageApplications, + MsixPackageDependencies, + NetworkInfoPatchProperties, + NetworkInfoProperties, + OperationProperties, + Plan, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResultWithSystemData, + PrivateEndpointConnectionProperties, + PrivateEndpointConnectionWithSystemData, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + ProxyResource, + RegistrationInfo, + RegistrationInfoPatch, + RegistrationTokenList, + RegistrationTokenMinimal, + Resource, + ResourceProviderOperation, + ResourceProviderOperationDisplay, + ResourceProviderOperationListResult, + ScalingHostPoolReference, + ScalingPlan, + ScalingPlanList, + ScalingPlanPatch, + ScalingPlanPatchProperties, + ScalingPlanPersonalSchedule, + ScalingPlanPersonalScheduleList, + ScalingPlanPersonalSchedulePatch, + ScalingPlanPersonalSchedulePatchProperties, + ScalingPlanPooledSchedule, + ScalingPlanPooledScheduleList, + ScalingPlanPooledSchedulePatch, + ScalingPlanPooledSchedulePatchProperties, + ScalingSchedule, + SecurityInfoPatchProperties, + SecurityInfoProperties, + SendMessage, + ServiceSpecification, + SessionHost, + SessionHostConfiguration, + SessionHostConfigurationList, + SessionHostConfigurationPatch, + SessionHostConfigurationPatchProperties, + SessionHostHealthCheckFailureDetails, + SessionHostHealthCheckReport, + SessionHostList, + SessionHostManagement, + SessionHostManagementList, + SessionHostManagementOperationProgress, + SessionHostManagementPatch, + SessionHostManagementPatchProperties, + SessionHostManagementUpdateStatus, + SessionHostManagementUpdateStatusProperties, + SessionHostPatch, + SessionHostPatchProperties, + Sku, + StartMenuItem, + StartMenuItemList, + StartMenuItemProperties, + SystemData, + Time, + TrackedResource, + UpdateSessionHostsRequestBody, + UserAssignedIdentity, + UserSession, + UserSessionList, + Workspace, + WorkspaceList, + WorkspacePatch, + WorkspacePatchProperties, +) + +from ._desktop_virtualization_mgmt_client_enums import ( # type: ignore + AppAttachPackageArchitectures, + ApplicationGroupType, + ApplicationType, + CommandLineSetting, + CreatedByType, + DayOfWeek, + DirectUDP, + DomainJoinType, + FailHealthCheckOnStagingFailure, + HealthCheckName, + HealthCheckResult, + HostPoolType, + HostPoolUpdateAction, + HostpoolPublicNetworkAccess, + LoadBalancerType, + ManagedPrivateUDP, + ManagedServiceIdentityType, + ManagementType, + PackageTimestamped, + PersonalDesktopAssignmentType, + PreferredAppGroupType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + ProvisioningStateSHC, + PublicNetworkAccess, + PublicUDP, + RegistrationTokenOperation, + RelayUDP, + RemoteApplicationType, + SSOSecretType, + ScalingHostPoolType, + SessionHandlingOperation, + SessionHostComponentUpdateType, + SessionHostLoadBalancingAlgorithm, + SessionHostManagementUpdateOperationStatus, + SessionState, + SetStartVMOnConnect, + SkuTier, + StartupBehavior, + Status, + StopHostsWhen, + Type, + UpdateState, + VirtualMachineDiskType, + VirtualMachineSecurityType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActiveDirectoryInfoPatchProperties", + "ActiveDirectoryInfoProperties", + "ActiveSessionHostConfiguration", + "ActiveSessionHostConfigurationList", "AgentUpdatePatchProperties", "AgentUpdateProperties", "AppAttachPackage", @@ -141,44 +215,70 @@ "AppAttachPackageList", "AppAttachPackagePatch", "AppAttachPackagePatchProperties", - "AppAttachPackageProperties", "Application", "ApplicationGroup", "ApplicationGroupList", "ApplicationGroupPatch", + "ApplicationGroupPatchProperties", "ApplicationList", "ApplicationPatch", - "CloudErrorProperties", + "ApplicationPatchProperties", + "AzureActiveDirectoryInfoProperties", + "BootDiagnosticsInfoPatchProperties", + "BootDiagnosticsInfoProperties", + "CustomInfoPatchProperties", + "CustomInfoProperties", "Desktop", "DesktopList", "DesktopPatch", + "DesktopPatchProperties", + "DiskInfoPatchProperties", + "DiskInfoProperties", + "DomainInfoPatchProperties", + "DomainInfoProperties", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "ExpandMsixImage", "ExpandMsixImageList", + "ExpandMsixImageProperties", "HostPool", "HostPoolList", "HostPoolPatch", - "Identity", + "HostPoolPatchProperties", + "HostPoolUpdateConfigurationPatchProperties", + "HostPoolUpdateConfigurationProperties", + "HostPoolUpdateControlParameter", + "ImageInfoPatchProperties", + "ImageInfoProperties", "ImportPackageInfoRequest", + "KeyVaultCredentialsPatchProperties", + "KeyVaultCredentialsProperties", "LogSpecification", "MSIXImageURI", "MSIXPackage", "MSIXPackageList", "MSIXPackagePatch", + "MSIXPackagePatchProperties", "MaintenanceWindowPatchProperties", "MaintenanceWindowProperties", + "ManagedServiceIdentity", + "MarketplaceInfoPatchProperties", + "MarketplaceInfoProperties", "MsixPackageApplications", "MsixPackageDependencies", + "NetworkInfoPatchProperties", + "NetworkInfoProperties", "OperationProperties", "Plan", "PrivateEndpoint", "PrivateEndpointConnection", "PrivateEndpointConnectionListResultWithSystemData", + "PrivateEndpointConnectionProperties", "PrivateEndpointConnectionWithSystemData", "PrivateLinkResource", "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", "ProxyResource", "RegistrationInfo", @@ -186,76 +286,105 @@ "RegistrationTokenList", "RegistrationTokenMinimal", "Resource", - "ResourceModelWithAllowedPropertySet", - "ResourceModelWithAllowedPropertySetIdentity", - "ResourceModelWithAllowedPropertySetPlan", - "ResourceModelWithAllowedPropertySetSku", "ResourceProviderOperation", "ResourceProviderOperationDisplay", - "ResourceProviderOperationList", + "ResourceProviderOperationListResult", "ScalingHostPoolReference", "ScalingPlan", "ScalingPlanList", "ScalingPlanPatch", + "ScalingPlanPatchProperties", "ScalingPlanPersonalSchedule", "ScalingPlanPersonalScheduleList", "ScalingPlanPersonalSchedulePatch", + "ScalingPlanPersonalSchedulePatchProperties", "ScalingPlanPooledSchedule", "ScalingPlanPooledScheduleList", "ScalingPlanPooledSchedulePatch", + "ScalingPlanPooledSchedulePatchProperties", "ScalingSchedule", + "SecurityInfoPatchProperties", + "SecurityInfoProperties", "SendMessage", "ServiceSpecification", "SessionHost", + "SessionHostConfiguration", + "SessionHostConfigurationList", + "SessionHostConfigurationPatch", + "SessionHostConfigurationPatchProperties", "SessionHostHealthCheckFailureDetails", "SessionHostHealthCheckReport", "SessionHostList", + "SessionHostManagement", + "SessionHostManagementList", + "SessionHostManagementOperationProgress", + "SessionHostManagementPatch", + "SessionHostManagementPatchProperties", + "SessionHostManagementUpdateStatus", + "SessionHostManagementUpdateStatusProperties", "SessionHostPatch", + "SessionHostPatchProperties", "Sku", "StartMenuItem", "StartMenuItemList", + "StartMenuItemProperties", "SystemData", "Time", "TrackedResource", + "UpdateSessionHostsRequestBody", + "UserAssignedIdentity", "UserSession", "UserSessionList", "Workspace", "WorkspaceList", "WorkspacePatch", + "WorkspacePatchProperties", "AppAttachPackageArchitectures", "ApplicationGroupType", "ApplicationType", "CommandLineSetting", "CreatedByType", "DayOfWeek", + "DirectUDP", + "DomainJoinType", "FailHealthCheckOnStagingFailure", "HealthCheckName", "HealthCheckResult", "HostPoolType", + "HostPoolUpdateAction", "HostpoolPublicNetworkAccess", "LoadBalancerType", + "ManagedPrivateUDP", + "ManagedServiceIdentityType", + "ManagementType", "PackageTimestamped", "PersonalDesktopAssignmentType", "PreferredAppGroupType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", "ProvisioningState", + "ProvisioningStateSHC", "PublicNetworkAccess", + "PublicUDP", "RegistrationTokenOperation", + "RelayUDP", "RemoteApplicationType", "SSOSecretType", "ScalingHostPoolType", - "ScalingScheduleDaysOfWeekItem", "SessionHandlingOperation", "SessionHostComponentUpdateType", "SessionHostLoadBalancingAlgorithm", + "SessionHostManagementUpdateOperationStatus", "SessionState", "SetStartVMOnConnect", "SkuTier", "StartupBehavior", "Status", "StopHostsWhen", + "Type", "UpdateState", + "VirtualMachineDiskType", + "VirtualMachineSecurityType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/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 81bb4af5b02b..2c75509f7fb9 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 @@ -14,26 +14,37 @@ class AppAttachPackageArchitectures(str, Enum, metaclass=CaseInsensitiveEnumMeta """Possible device architectures that an app attach package can be configured for.""" ARM = "ARM" + """ARM 32-bit""" ARM64 = "ARM64" + """ARM 64-bit""" X86 = "x86" + """32-bit x86""" X64 = "x64" + """64-bit""" NEUTRAL = "Neutral" + """Any architecture can be used""" X86_A64 = "x86a64" + """X86 Compiled Hybrid Portable Executable for ARM64""" ALL = "ALL" + """Select all listed applications, no filters""" class ApplicationGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of ApplicationGroup.""" REMOTE_APP = "RemoteApp" + """Application group is Remote and can launch individual applications without a Desktop.""" DESKTOP = "Desktop" + """Application Group delivers a full expected Desktop experience""" class ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Application type of application.""" REMOTE_APP = "RemoteApp" + """Remote Applications (non-desktop)""" DESKTOP = "Desktop" + """Desktop Applications""" class CommandLineSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -43,8 +54,11 @@ class CommandLineSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ DO_NOT_ALLOW = "DoNotAllow" + """Cannot be launched with command line arguments.""" ALLOW = "Allow" + """Can optionally be launched with command line arguments.""" REQUIRE = "Require" + """Required to be launched with command line arguments.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,7 +71,7 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Day of the week.""" + """Day of the week. Modeled as string.""" MONDAY = "Monday" TUESDAY = "Tuesday" @@ -68,12 +82,35 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUNDAY = "Sunday" +class DirectUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direct UDP Connection Settings.""" + + DEFAULT = "Default" + """AVD-wide settings are used to determine connection availability""" + ENABLED = "Enabled" + """UDP will attempt this connection type when making connections.""" + DISABLED = "Disabled" + """UDP will not attempt this connection type when making connections""" + + +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" + """Health Check will report unhealthy""" NEEDS_ASSISTANCE = "NeedsAssistance" + """Health Check will report NeedsAssistance""" DO_NOT_FAIL = "DoNotFail" + """Health Check will not report failure""" class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -126,7 +163,7 @@ class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 + de-registration/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 @@ -147,14 +184,16 @@ class HealthCheckResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): class HostpoolPublicNetworkAccess(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. - """ + """Enabled to allow this resource to be access from the public network.""" ENABLED = "Enabled" + """Allows this resource to be accessed from the public network""" DISABLED = "Disabled" + """Prevents this resource from being accessed from the public network""" ENABLED_FOR_SESSION_HOSTS_ONLY = "EnabledForSessionHostsOnly" + """Allows SessionHosts to be accessed from the public network""" ENABLED_FOR_CLIENTS_ONLY = "EnabledForClientsOnly" + """Allows Clients to be accessed from the public network""" class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -171,84 +210,193 @@ class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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): """The type of the load balancer.""" BREADTH_FIRST = "BreadthFirst" + """Uses BreadthFirst algorithm for load balancing.""" DEPTH_FIRST = "DepthFirst" + """Uses DepthFirst algorithm for load balancing.""" PERSISTENT = "Persistent" + """Maintains persistent connections.""" + MULTIPLE_PERSISTENT = "MultiplePersistent" + """Maintains multiple persistents connections.""" + + +class ManagedPrivateUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Managed Private UDP Connection Settings.""" + + DEFAULT = "Default" + """AVD-wide settings are used to determine connection availability""" + ENABLED = "Enabled" + """UDP will attempt this connection type when making connections.""" + DISABLED = "Disabled" + """UDP will not attempt this connection type when making connections""" + + +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 the hostpool.""" + + AUTOMATED = "Automated" + """Automated management of the hostpool""" + STANDARD = "Standard" + """Standard management of the hostpool""" class PackageTimestamped(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Is package timestamped so it can ignore the certificate expiry date.""" TIMESTAMPED = "Timestamped" + """Package is timestamped""" NOT_TIMESTAMPED = "NotTimestamped" + """Package is not timestamped, use certificate expiry date""" class PersonalDesktopAssignmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PersonalDesktopAssignment type for HostPool.""" AUTOMATIC = "Automatic" + """Automatically assigns an available personal desktop to the user.""" DIRECT = "Direct" + """Manually assigns a specific personal desktop to the user.""" class PreferredAppGroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of preferred application group type, default to Desktop Application Group.""" NONE = "None" + """Internal Use Only""" DESKTOP = "Desktop" + """Use Desktop Application Group""" RAIL_APPLICATIONS = "RailApplications" + """Use RailApplications (RemoteApp)""" class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state.""" SUCCEEDED = "Succeeded" + """Provisioning was successful""" CREATING = "Creating" + """A PrivateEndpointConnection is being created""" DELETING = "Deleting" + """A PrivateEndpointConnection is being deleted""" FAILED = "Failed" + """Provisioning failed""" class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status.""" PENDING = "Pending" + """Connection is Pending""" APPROVED = "Approved" + """Connection was Approved""" REJECTED = "Rejected" + """Connection was rejected""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state.""" SUCCEEDED = "Succeeded" + """Provisioning Successful""" PROVISIONING = "Provisioning" + """Provisioning in Progress""" FAILED = "Failed" + """Provisioning Failed""" CANCELED = "Canceled" + """Provisioning was Canceled""" + + +class ProvisioningStateSHC(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Session Host Configuration.""" + + SUCCEEDED = "Succeeded" + """Provisioning Successful""" + FAILED = "Failed" + """Provisioning Failed""" + CANCELED = "Canceled" + """Provisioning was Canceled""" + PROVISIONING = "Provisioning" + """Provisioning in Progress""" 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. - """ + """Enabled to allow this resource to be access from the public network.""" + + ENABLED = "Enabled" + """This resource is accessible from the public network.""" + DISABLED = "Disabled" + """This resource is not accessible from the public network.""" + +class PublicUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Public UDP Connection Settings.""" + + DEFAULT = "Default" + """AVD-wide settings are used to determine connection availability""" ENABLED = "Enabled" + """UDP will attempt this connection type when making connections.""" DISABLED = "Disabled" + """UDP will not attempt this connection type when making connections""" class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of resetting the token.""" DELETE = "Delete" + """Delete operation""" NONE = "None" + """No Operation""" UPDATE = "Update" + """Update Operation""" + + +class RelayUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Relay UDP Connection Settings.""" + + DEFAULT = "Default" + """AVD-wide settings are used to determine connection availability""" + ENABLED = "Enabled" + """UDP will attempt this connection type when making connections.""" + DISABLED = "Disabled" + """UDP will not attempt this connection type when making connections""" class RemoteApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of Application.""" IN_BUILT = "InBuilt" + """Built-in applications""" MSIX_APPLICATION = "MsixApplication" + """Imported MSIX application packages""" class ScalingHostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -256,26 +404,21 @@ 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): """Action to be taken after a user disconnect during the ramp up period.""" NONE = "None" + """No action will be taken after disconnect""" DEALLOCATE = "Deallocate" + """Session Host will be deallocated after disconnect""" HIBERNATE = "Hibernate" + """Session Host will hibernate after disconnect""" class SessionHostComponentUpdateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -291,18 +434,51 @@ class SessionHostLoadBalancingAlgorithm(str, Enum, metaclass=CaseInsensitiveEnum """Load balancing algorithm for ramp up period.""" BREADTH_FIRST = "BreadthFirst" + """Breadth First Algorithm for Load Balancing""" DEPTH_FIRST = "DepthFirst" + """Depth First Algorithm for Load Balancing""" + + +class SessionHostManagementUpdateOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operation status for SessionHostManagementUpdate.""" + + ERROR = "Error" + """The operation has an error.""" + SCHEDULED = "Scheduled" + """The operation is scheduled.""" + UPDATING_SESSION_HOSTS = "UpdatingSessionHosts" + """The operation is currently updating Session Hosts.""" + VALIDATING_SESSION_HOST_UPDATE = "ValidatingSessionHostUpdate" + """The operation is validating the update.""" + PAUSED = "Paused" + """The operation is paused.""" + PAUSING = "Pausing" + """The operation is pausing.""" + CANCELLING = "Cancelling" + """Canceling the operation.""" + SUCCEEDED = "Succeeded" + """The operation succeeded.""" + FAILED = "Failed" + """The operation failed.""" + CANCELLED = "Cancelled" + """The operation is canceled""" class SessionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of user session.""" UNKNOWN = "Unknown" + """SessionState is unknown""" ACTIVE = "Active" + """Session is active""" DISCONNECTED = "Disconnected" + """Session is disconnected""" PENDING = "Pending" + """Session is pending connection""" LOG_OFF = "LogOff" + """Session is logging off""" USER_PROFILE_DISK_MOUNTED = "UserProfileDiskMounted" + """Session has mounted user profile disk""" class SetStartVMOnConnect(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -312,7 +488,9 @@ class SetStartVMOnConnect(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ ENABLE = "Enable" + """Start VM on Connect is enabled""" DISABLE = "Disable" + """Start VM on Connect is disabled, must use rampUpAutoStartHosts or turn on manually""" class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -330,9 +508,13 @@ class SSOSecretType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of single sign on Secret Type.""" SHARED_KEY = "SharedKey" + """The SSO Secret is a Shared Key.""" CERTIFICATE = "Certificate" + """The SSO Secret is a Certificate.""" SHARED_KEY_IN_KEY_VAULT = "SharedKeyInKeyVault" + """The SSO Secret is a SharedKey that is stored in KeyVault.""" CERTIFICATE_IN_KEY_VAULT = "CertificateInKeyVault" + """The SSO Secret is a Certificate that is stored in KeyVault.""" class StartupBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -386,14 +568,53 @@ class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies when to stop hosts during ramp down period.""" ZERO_SESSIONS = "ZeroSessions" + """Zero Total Sessions""" ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" + """Zero Active Sessions""" + + +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.""" INITIAL = "Initial" + """Update is initializing""" PENDING = "Pending" + """Update is pending""" STARTED = "Started" + """Update has started""" SUCCEEDED = "Succeeded" + """Update has succeeded""" FAILED = "Failed" + """Update has 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 and 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 fa56640fb1de..155264fee4dc 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 @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,15 +8,358 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +class 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 ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. 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 + """ + + +class ActiveSessionHostConfiguration(ProxyResource): + """Schema for ActiveSessionHostConfiguration 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 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 the 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 the 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. + + All required parameters must be populated in order to send to server. + + :ivar value: The ActiveSessionHostConfiguration items on this page. Required. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ActiveSessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ActiveSessionHostConfiguration"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ActiveSessionHostConfiguration items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class AgentUpdatePatchProperties(_serialization.Model): """The session host configuration for updating agent, monitoring agent, and stack component. @@ -127,47 +470,6 @@ 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. - - 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 TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -244,8 +546,29 @@ class AppAttachPackage(TrackedResource): :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 + :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 path to certificate name located in keyVault. + :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 = { @@ -254,7 +577,7 @@ class AppAttachPackage(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "properties": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -264,15 +587,28 @@ class AppAttachPackage(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AppAttachPackageProperties"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "image": {"key": "properties.image", "type": "AppAttachPackageInfoProperties"}, + "host_pool_references": {"key": "properties.hostPoolReferences", "type": "[str]"}, + "key_vault_url": {"key": "properties.keyVaultURL", "type": "str"}, + "fail_health_check_on_staging_failure": {"key": "properties.failHealthCheckOnStagingFailure", "type": "str"}, + "package_owner_name": {"key": "properties.packageOwnerName", "type": "str"}, + "package_lookback_url": {"key": "properties.packageLookbackUrl", "type": "str"}, + "custom_data": {"key": "properties.customData", "type": "str"}, } def __init__( self, *, location: str, - properties: "_models.AppAttachPackageProperties", tags: Optional[Dict[str, str]] = None, + 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: """ @@ -280,14 +616,39 @@ def __init__( :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 + :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 path to certificate name located in keyVault. + :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__(tags=tags, location=location, **kwargs) - self.properties = properties + 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 AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class AppAttachPackageInfoProperties(_serialization.Model): """Schema for Import Package Information properties. :ivar package_alias: Alias of App Attach Package. Assigned at import time. @@ -430,16 +791,16 @@ def __init__( 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. + All required parameters must be populated in order to send to server. - :ivar value: List of App Attach Package definitions. + :ivar value: The AppAttachPackage items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -447,14 +808,18 @@ class AppAttachPackageList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.AppAttachPackage"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.AppAttachPackage"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of App Attach Package definitions. + :keyword value: The AppAttachPackage items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class AppAttachPackagePatch(Resource): @@ -473,6 +838,8 @@ class AppAttachPackagePatch(Resource): :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 """ @@ -489,17 +856,25 @@ class AppAttachPackagePatch(Resource): "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, *, properties: Optional["_models.AppAttachPackagePatchProperties"] = None, **kwargs: Any + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AppAttachPackagePatchProperties"] = None, + **kwargs: Any ) -> None: """ - :keyword properties: Detailed properties for App Attach Package. + :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 @@ -517,6 +892,12 @@ class AppAttachPackagePatchProperties(_serialization.Model): "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, 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 """ _attribute_map = { @@ -524,6 +905,8 @@ class AppAttachPackagePatchProperties(_serialization.Model): "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__( @@ -533,6 +916,8 @@ def __init__( 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: """ @@ -547,78 +932,23 @@ def __init__( "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, 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.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 path to certificate name located in keyVault. - :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 - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "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"}, - } - - 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, - **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 path to certificate name located in keyVault. - :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 - """ - super().__init__(**kwargs) - 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 - - -class Application(Resource): # pylint: disable=too-many-instance-attributes +class Application(ProxyResource): """Schema for Application properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -770,9 +1100,8 @@ def __init__( self.icon_content = None -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. +class ApplicationGroup(TrackedResource): + """Represents a ApplicationGroup definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -793,143 +1122,26 @@ class ResourceModelWithAllowedPropertySet(TrackedResource): # pylint: disable=t :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 - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :vartype managed_by: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar etag: If etag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in 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 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 - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - 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 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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, - "etag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "managed_by": {"key": "managedBy", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - managed_by: Optional[str] = None, - kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = 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 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 mode deployment will not delete the resource if it is removed from the template since - 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, - the resource provider must validate and persist this value. - :paramtype kind: 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__(tags=tags, location=location, **kwargs) - self.managed_by = managed_by - self.kind = kind - self.etag = None - self.identity = identity - self.sku = sku - self.plan = plan - - -class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many-instance-attributes - """Represents a ApplicationGroup 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 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 mode deployment will not delete the resource if it is removed from the template since it is 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, - 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 - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - 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 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 plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku :ivar object_id: ObjectId of ApplicationGroup. (internal use). :vartype object_id: str :ivar description: Description of ApplicationGroup. @@ -956,8 +1168,8 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "object_id": {"readonly": True}, "host_pool_arm_path": {"required": True}, "workspace_arm_path": {"readonly": True}, @@ -972,12 +1184,12 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "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"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "plan": {"key": "plan", "type": "Plan"}, + "sku": {"key": "sku", "type": "Sku"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -995,11 +1207,11 @@ def __init__( host_pool_arm_path: str, application_group_type: Union[str, "_models.ApplicationGroupType"], tags: Optional[Dict[str, str]] = None, - managed_by: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + managed_by: Optional[str] = None, + plan: Optional["_models.Plan"] = None, + sku: Optional["_models.Sku"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, show_in_feed: Optional[bool] = None, @@ -1010,23 +1222,21 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :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, + the resource provider must validate and persist this value. + :paramtype kind: 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, complete mode deployment will not delete the resource if it is removed from the template since 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, - the resource provider must validate and persist this value. - :paramtype kind: 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 plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku :keyword description: Description of ApplicationGroup. :paramtype description: str :keyword friendly_name: Friendly name of ApplicationGroup. @@ -1040,16 +1250,13 @@ def __init__( :keyword show_in_feed: Boolean representing whether the applicationGroup is show in the feed. :paramtype show_in_feed: bool """ - super().__init__( - tags=tags, - location=location, - managed_by=managed_by, - kind=kind, - identity=identity, - sku=sku, - plan=plan, - **kwargs - ) + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.etag = None + self.kind = kind + self.managed_by = managed_by + self.plan = plan + self.sku = sku self.object_id = None self.description = description self.friendly_name = friendly_name @@ -1063,16 +1270,16 @@ def __init__( class ApplicationGroupList(_serialization.Model): """List of ApplicationGroup definitions. - 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 value: List of ApplicationGroup definitions. + :ivar value: The ApplicationGroup items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1080,14 +1287,18 @@ class ApplicationGroupList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ApplicationGroup"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ApplicationGroup"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of ApplicationGroup definitions. + :keyword value: The ApplicationGroup items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class ApplicationGroupPatch(Resource): @@ -1108,12 +1319,8 @@ class ApplicationGroupPatch(Resource): :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] - :ivar description: Description of ApplicationGroup. - :vartype description: str - :ivar friendly_name: Friendly name of ApplicationGroup. - :vartype friendly_name: str - :ivar show_in_feed: Boolean representing whether the applicationGroup is show in the feed. - :vartype show_in_feed: bool + :ivar properties: ApplicationGroup properties that can be patched. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatchProperties """ _validation = { @@ -1129,23 +1336,53 @@ class ApplicationGroupPatch(Resource): "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"}, - "show_in_feed": {"key": "properties.showInFeed", "type": "bool"}, + "properties": {"key": "properties", "type": "ApplicationGroupPatchProperties"}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ApplicationGroupPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: ApplicationGroup properties that can be patched. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatchProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class ApplicationGroupPatchProperties(_serialization.Model): + """ApplicationGroup properties that can be patched. + + :ivar description: Description of ApplicationGroup. + :vartype description: str + :ivar friendly_name: Friendly name of ApplicationGroup. + :vartype friendly_name: str + :ivar show_in_feed: Boolean representing whether the applicationGroup is show in the feed. + :vartype show_in_feed: bool + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "show_in_feed": {"key": "showInFeed", "type": "bool"}, + } + + def __init__( + self, + *, description: Optional[str] = None, friendly_name: Optional[str] = None, show_in_feed: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] :keyword description: Description of ApplicationGroup. :paramtype description: str :keyword friendly_name: Friendly name of ApplicationGroup. @@ -1154,7 +1391,6 @@ def __init__( :paramtype show_in_feed: bool """ super().__init__(**kwargs) - self.tags = tags self.description = description self.friendly_name = friendly_name self.show_in_feed = show_in_feed @@ -1163,16 +1399,16 @@ def __init__( class ApplicationList(_serialization.Model): """List of Application definitions. - 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 value: List of Application definitions. + :ivar value: The Application items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.Application] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1180,21 +1416,41 @@ class ApplicationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Application"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Application"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of Application definitions. + :keyword value: The Application items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Application] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class ApplicationPatch(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ApplicationPatch(_serialization.Model): + """Application properties that can be patched. + + :ivar properties: Detailed properties for Application. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.ApplicationPatchProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ApplicationPatchProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ApplicationPatchProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Detailed properties for Application. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.ApplicationPatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ApplicationPatchProperties(_serialization.Model): """Application properties that can be patched. - :ivar tags: tags to be updated. - :vartype tags: dict[str, str] :ivar description: Description of Application. :vartype description: str :ivar friendly_name: Friendly name of Application. @@ -1227,24 +1483,22 @@ class ApplicationPatch(_serialization.Model): # pylint: disable=too-many-instan """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "file_path": {"key": "properties.filePath", "type": "str"}, - "command_line_setting": {"key": "properties.commandLineSetting", "type": "str"}, - "command_line_arguments": {"key": "properties.commandLineArguments", "type": "str"}, - "show_in_portal": {"key": "properties.showInPortal", "type": "bool"}, - "icon_path": {"key": "properties.iconPath", "type": "str"}, - "icon_index": {"key": "properties.iconIndex", "type": "int"}, - "msix_package_family_name": {"key": "properties.msixPackageFamilyName", "type": "str"}, - "msix_package_application_id": {"key": "properties.msixPackageApplicationId", "type": "str"}, - "application_type": {"key": "properties.applicationType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "file_path": {"key": "filePath", "type": "str"}, + "command_line_setting": {"key": "commandLineSetting", "type": "str"}, + "command_line_arguments": {"key": "commandLineArguments", "type": "str"}, + "show_in_portal": {"key": "showInPortal", "type": "bool"}, + "icon_path": {"key": "iconPath", "type": "str"}, + "icon_index": {"key": "iconIndex", "type": "int"}, + "msix_package_family_name": {"key": "msixPackageFamilyName", "type": "str"}, + "msix_package_application_id": {"key": "msixPackageApplicationId", "type": "str"}, + "application_type": {"key": "applicationType", "type": "str"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, file_path: Optional[str] = None, @@ -1259,8 +1513,6 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] :keyword description: Description of Application. :paramtype description: str :keyword friendly_name: Friendly name of Application. @@ -1293,7 +1545,6 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.RemoteApplicationType """ super().__init__(**kwargs) - self.tags = tags self.description = description self.friendly_name = friendly_name self.file_path = file_path @@ -1307,33 +1558,145 @@ def __init__( self.application_type = application_type -class CloudErrorProperties(_serialization.Model): - """Cloud error object properties. +class AzureActiveDirectoryInfoProperties(_serialization.Model): + """Azure Active directory info. Only one should be populated based on the join type. - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str + 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 = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "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 CustomInfoPatchProperties(_serialization.Model): + """Custom image information. + + :ivar resource_id: The resource ID of the 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 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 image. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str + :keyword resource_id: The resource ID of the image. Required. + :paramtype resource_id: str """ super().__init__(**kwargs) - self.code = code - self.message = message + self.resource_id = resource_id -class Desktop(Resource): +class Desktop(ProxyResource): """Schema for Desktop properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1403,16 +1766,16 @@ def __init__( class DesktopList(_serialization.Model): """List of Desktop definitions. - 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 value: List of Desktop definitions. + :ivar value: The Desktop items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.Desktop] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -1420,21 +1783,41 @@ class DesktopList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Desktop"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Desktop"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of Desktop definitions. + :keyword value: The Desktop items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Desktop] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class DesktopPatch(_serialization.Model): """Desktop properties that can be patched. - :ivar tags: tags to be updated. - :vartype tags: dict[str, str] + :ivar properties: Detailed properties for Desktop. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.DesktopPatchProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "DesktopPatchProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DesktopPatchProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Detailed properties for Desktop. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.DesktopPatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DesktopPatchProperties(_serialization.Model): + """Desktop properties that can be patched. + :ivar description: Description of Desktop. :vartype description: str :ivar friendly_name: Friendly name of Desktop. @@ -1442,33 +1825,158 @@ class DesktopPatch(_serialization.Model): """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, } def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - friendly_name: Optional[str] = None, - **kwargs: Any + self, *, description: Optional[str] = None, friendly_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] :keyword description: Description of Desktop. :paramtype description: str :keyword friendly_name: Friendly name of Desktop. :paramtype friendly_name: str """ super().__init__(**kwargs) - self.tags = tags self.description = description 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. @@ -1561,7 +2069,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes +class ExpandMsixImage(Resource): """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. @@ -1577,6 +2085,71 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar properties: Detailed properties for ExpandMsixImage. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.ExpandMsixImageProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "ExpandMsixImageProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ExpandMsixImageProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Detailed properties for ExpandMsixImage. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.ExpandMsixImageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ExpandMsixImageList(_serialization.Model): + """List of MSIX package properties retrieved from MSIX Image expansion. + + All required parameters must be populated in order to send to server. + + :ivar value: The ExpandMsixImage items on this page. Required. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExpandMsixImage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ExpandMsixImage"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ExpandMsixImage items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExpandMsixImageProperties(_serialization.Model): + """Schema for Expand MSIX Image properties. + :ivar package_alias: Alias of MSIX Package. :vartype package_alias: str :ivar image_path: VHD/CIM image path on Network Share. @@ -1612,33 +2185,22 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :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"}, - "package_family_name": {"key": "properties.packageFamilyName", "type": "str"}, - "package_full_name": {"key": "properties.packageFullName", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "package_relative_path": {"key": "properties.packageRelativePath", "type": "str"}, - "is_regular_registration": {"key": "properties.isRegularRegistration", "type": "bool"}, - "is_active": {"key": "properties.isActive", "type": "bool"}, - "package_dependencies": {"key": "properties.packageDependencies", "type": "[MsixPackageDependencies]"}, - "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"}, + "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"}, } def __init__( @@ -1714,38 +2276,8 @@ def __init__( self.certificate_expiry = certificate_expiry -class ExpandMsixImageList(_serialization.Model): - """List of MSIX package properties retrieved from MSIX Image expansion. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of MSIX package properties from give MSIX Image. - :vartype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] - :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": "[ExpandMsixImage]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ExpandMsixImage"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of MSIX package properties from give MSIX Image. - :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many-instance-attributes - """Represents a HostPool definition. +class HostPool(TrackedResource): + """Represents a HostPool definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1766,28 +2298,26 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar etag: If etag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in 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 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, + the resource provider must validate and persist this value. + :vartype kind: 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 mode deployment will not delete the resource if it is removed from the template since it is 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, - 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 - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - 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 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 plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku :ivar object_id: ObjectId of HostPool. (internal use). :vartype object_id: str :ivar friendly_name: Friendly name of HostPool. @@ -1806,7 +2336,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 @@ -1853,6 +2383,33 @@ 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 + :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 """ _validation = { @@ -1861,8 +2418,8 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "object_id": {"readonly": True}, "host_pool_type": {"required": True}, "load_balancer_type": {"required": True}, @@ -1880,12 +2437,12 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "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"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "plan": {"key": "plan", "type": "Plan"}, + "sku": {"key": "sku", "type": "Sku"}, "object_id": {"key": "properties.objectId", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -1913,6 +2470,11 @@ 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"}, + "management_type": {"key": "properties.managementType", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1923,11 +2485,11 @@ def __init__( # pylint: disable=too-many-locals load_balancer_type: Union[str, "_models.LoadBalancerType"], preferred_app_group_type: Union[str, "_models.PreferredAppGroupType"], tags: Optional[Dict[str, str]] = None, - managed_by: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + managed_by: Optional[str] = None, + plan: Optional["_models.Plan"] = None, + sku: Optional["_models.Sku"] = None, friendly_name: Optional[str] = None, description: Optional[str] = None, personal_desktop_assignment_type: Optional[Union[str, "_models.PersonalDesktopAssignmentType"]] = None, @@ -1944,6 +2506,11 @@ 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, + management_type: Optional[Union[str, "_models.ManagementType"]] = None, **kwargs: Any ) -> None: """ @@ -1951,23 +2518,21 @@ def __init__( # pylint: disable=too-many-locals :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :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, + the resource provider must validate and persist this value. + :paramtype kind: 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, complete mode deployment will not delete the resource if it is removed from the template since 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, - the resource provider must validate and persist this value. - :paramtype kind: 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 plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku :keyword friendly_name: Friendly name of HostPool. :paramtype friendly_name: str :keyword description: Description of HostPool. @@ -1984,7 +2549,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 @@ -2021,17 +2586,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 + :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 """ - super().__init__( - tags=tags, - location=location, - managed_by=managed_by, - kind=kind, - identity=identity, - sku=sku, - plan=plan, - **kwargs - ) + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.etag = None + self.kind = kind + self.managed_by = managed_by + self.plan = plan + self.sku = sku self.object_id = None self.friendly_name = friendly_name self.description = description @@ -2056,21 +2646,26 @@ 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 + self.management_type = management_type class HostPoolList(_serialization.Model): """List of HostPool definitions. - 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 value: List of HostPool definitions. + :ivar value: The HostPool items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.HostPool] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -2078,17 +2673,19 @@ class HostPoolList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.HostPool"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.HostPool"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of HostPool definitions. + :keyword value: The HostPool items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.HostPool] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes +class HostPoolPatch(Resource): """HostPool properties that can be patched. Variables are only populated by the server, and will be ignored when sending a request. @@ -2106,6 +2703,47 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar tags: tags to be updated. :vartype tags: dict[str, str] + :ivar properties: HostPool properties that can be patched. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.HostPoolPatchProperties + """ + + _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": "HostPoolPatchProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.HostPoolPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: HostPool properties that can be patched. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.HostPoolPatchProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class HostPoolPatchProperties(_serialization.Model): + """Properties of HostPool. + :ivar friendly_name: Friendly name of HostPool. :vartype friendly_name: str :ivar description: Description of HostPool. @@ -2119,7 +2757,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 @@ -2154,45 +2792,60 @@ 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"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "custom_rdp_property": {"key": "customRdpProperty", "type": "str"}, + "max_session_limit": {"key": "maxSessionLimit", "type": "int"}, + "personal_desktop_assignment_type": {"key": "personalDesktopAssignmentType", "type": "str"}, + "load_balancer_type": {"key": "loadBalancerType", "type": "str"}, + "ring": {"key": "ring", "type": "int"}, + "validation_environment": {"key": "validationEnvironment", "type": "bool"}, + "registration_info": {"key": "registrationInfo", "type": "RegistrationInfoPatch"}, + "vm_template": {"key": "vmTemplate", "type": "str"}, + "ssoadfs_authority": {"key": "ssoadfsAuthority", "type": "str"}, + "sso_client_id": {"key": "ssoClientId", "type": "str"}, + "sso_client_secret_key_vault_path": {"key": "ssoClientSecretKeyVaultPath", "type": "str"}, + "sso_secret_type": {"key": "ssoSecretType", "type": "str"}, + "preferred_app_group_type": {"key": "preferredAppGroupType", "type": "str"}, + "start_vm_on_connect": {"key": "startVMOnConnect", "type": "bool"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "agent_update": {"key": "agentUpdate", "type": "AgentUpdatePatchProperties"}, + "managed_private_udp": {"key": "managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "directUDP", "type": "str"}, + "public_udp": {"key": "publicUDP", "type": "str"}, + "relay_udp": {"key": "relayUDP", "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, @@ -2211,11 +2864,13 @@ def __init__( 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. @@ -2229,7 +2884,7 @@ def __init__( :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". + "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 @@ -2264,9 +2919,33 @@ def __init__( :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 @@ -2285,41 +2964,260 @@ def __init__( 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. Default value is an empty + string. + :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. 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 Identity(_serialization.Model): - """Identity for the resource. - Variables are only populated by the server, and will be ignored when sending a request. +class HostPoolUpdateConfigurationProperties(_serialization.Model): + """The configurations of a hostpool update. - :ivar principal_id: The principal ID of resource identity. The value must be an UUID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. The value must be an UUID. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str + 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 = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, + "max_vms_removed": {"required": True, "minimum": 1}, + "log_off_delay_minutes": {"required": True}, + "log_off_message": {"max_length": 260}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, + "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): + """Object containing control action for hostpool update. + + 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 ImageInfoPatchProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + :ivar type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :vartype 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 = { "type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoPatchProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoPatchProperties"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "_models.Type"]] = None, + marketplace_info: Optional["_models.MarketplaceInfoPatchProperties"] = None, + custom_info: Optional["_models.CustomInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str + :keyword type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :paramtype 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.type = 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 type: The type of image session hosts use in the hostpool. Required. Known values are: + "Marketplace" and "Custom". + :vartype 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 = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoProperties"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.Type"], + marketplace_info: Optional["_models.MarketplaceInfoProperties"] = None, + custom_info: Optional["_models.CustomInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of image session hosts use in the hostpool. Required. Known values are: + "Marketplace" and "Custom". + :paramtype 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.principal_id = None - self.tenant_id = None self.type = type + self.marketplace_info = marketplace_info + self.custom_info = custom_info class ImportPackageInfoRequest(_serialization.Model): @@ -2358,6 +3256,81 @@ def __init__( 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 = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, + *, + username_key_vault_secret_uri: Optional[str] = None, + password_key_vault_secret_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri + + +class KeyVaultCredentialsProperties(_serialization.Model): + """Credentials kept in the keyvault. + + All required parameters must be populated in order to send to server. + + :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 = { + "username_key_vault_secret_uri": {"required": True}, + "password_key_vault_secret_uri": {"required": True}, + } + + _attribute_map = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, *, username_key_vault_secret_uri: str, password_key_vault_secret_uri: str, **kwargs: Any + ) -> None: + """ + :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.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): """Specifications of the Log for Azure Monitoring. @@ -2465,19 +3438,176 @@ def __init__( self.day_of_week = day_of_week -class MSIXImageURI(_serialization.Model): - """Represents URI referring to MSIX Image. +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). - :ivar uri: URI to Image. - :vartype uri: str - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } + All required parameters must be populated in order to send to server. - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: - """ + :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 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 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 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 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. + + :ivar uri: URI to Image. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: + """ :keyword uri: URI to Image. :paramtype uri: str """ @@ -2485,7 +3615,7 @@ def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: self.uri = uri -class MSIXPackage(Resource): # pylint: disable=too-many-instance-attributes +class MSIXPackage(ProxyResource): """Schema for MSIX Package properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -2721,16 +3851,16 @@ def __init__( class MSIXPackageList(_serialization.Model): """List of MSIX Package definitions. - 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 value: List of MSIX Package definitions. + :ivar value: The MSIXPackage items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.MSIXPackage] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -2738,14 +3868,16 @@ class MSIXPackageList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.MSIXPackage"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.MSIXPackage"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of MSIX Package definitions. + :keyword value: The MSIXPackage items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.MSIXPackage] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class MSIXPackagePatch(Resource): @@ -2764,12 +3896,8 @@ class MSIXPackagePatch(Resource): :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. - :vartype is_regular_registration: bool - :ivar display_name: Display name for MSIX Package. - :vartype display_name: str + :ivar properties: Detailed properties for MSIX Package. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatchProperties """ _validation = { @@ -2784,9 +3912,33 @@ class MSIXPackagePatch(Resource): "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"}, + "properties": {"key": "properties", "type": "MSIXPackagePatchProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MSIXPackagePatchProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Detailed properties for MSIX Package. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MSIXPackagePatchProperties(_serialization.Model): + """MSIX Package properties that can be patched. + + :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. + :vartype is_regular_registration: bool + :ivar display_name: Display name for MSIX Package. + :vartype display_name: str + """ + + _attribute_map = { + "is_active": {"key": "isActive", "type": "bool"}, + "is_regular_registration": {"key": "isRegularRegistration", "type": "bool"}, + "display_name": {"key": "displayName", "type": "str"}, } def __init__( @@ -2811,6 +3963,70 @@ def __init__( 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 = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__(self, *, subnet_id: str, security_group_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :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.subnet_id = subnet_id + self.security_group_id = security_group_id + + class OperationProperties(_serialization.Model): """Properties of the operation. @@ -2939,18 +4155,9 @@ class PrivateEndpointConnection(Resource): :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. - :vartype private_link_service_connection_state: - ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState + :ivar properties: Resource properties. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProperties """ _validation = { @@ -2958,8 +4165,6 @@ class PrivateEndpointConnection(Resource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "group_ids": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -2967,51 +4172,35 @@ class PrivateEndpointConnection(Resource): "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", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, } def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any + self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any ) -> None: """ - :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. - :paramtype private_link_service_connection_state: - ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :keyword properties: Resource properties. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProperties """ 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 + self.properties = properties class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): # pylint: disable=name-too-long - """List of private endpoint connection associated with the specified storage account. + """List of private endpoint connection associated with the specified HostPool. - 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 value: Array of private endpoint connections. + :ivar value: The PrivateEndpointConnectionWithSystemData items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3020,40 +4209,37 @@ class PrivateEndpointConnectionListResultWithSystemData(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PrivateEndpointConnectionWithSystemData"]] = None, **kwargs: Any + self, + *, + value: List["_models.PrivateEndpointConnectionWithSystemData"], + next_link: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword value: Array of private endpoint connections. + :keyword value: The PrivateEndpointConnectionWithSystemData items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): - """The Private Endpoint Connection resource. +class PrivateEndpointConnectionProperties(_serialization.Model): + """Properties of the private endpoint connection. 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 + All required parameters must be populated in order to send to server. + :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. + connection between service consumer and provider. Required. :vartype private_link_service_connection_state: ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. @@ -3062,9 +4248,46 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + "group_ids": {"readonly": True}, + "private_link_service_connection_state": {"required": True}, + "provisioning_state": {"readonly": True}, + } -class PrivateLinkResource(Resource): - """A private link resource. + _attribute_map = { + "group_ids": {"key": "groupIds", "type": "[str]"}, + "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + **kwargs: Any + ) -> None: + """ + :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. Required. + :paramtype private_link_service_connection_state: + ~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 PrivateEndpointConnectionWithSystemData(ProxyResource): + """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3079,21 +4302,27 @@ class PrivateLinkResource(Resource): :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. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + :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. + :vartype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, "system_data": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -3101,35 +4330,94 @@ class PrivateLinkResource(Resource): "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]"}, + "group_ids": {"key": "properties.groupIds", "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"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs: Any + ) -> None: """ - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] + :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. + :paramtype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names + 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 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. 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 properties: Resource properties. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.PrivateLinkResourceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Resource properties. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties class PrivateLinkResourceListResult(_serialization.Model): """A list of private link resources. - 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 value: Array of private link resources. + :ivar value: The PrivateLinkResource items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3137,14 +4425,53 @@ class PrivateLinkResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.PrivateLinkResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Array of private link resources. + :keyword value: The PrivateLinkResource items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link + + +class PrivateLinkResourceProperties(_serialization.Model): + """Properties of a private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + } + + _attribute_map = { + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, + } + + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super().__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names class PrivateLinkServiceConnectionState(_serialization.Model): @@ -3193,26 +4520,6 @@ def __init__( self.actions_required = actions_required -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. 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 - """ - - class RegistrationInfo(_serialization.Model): """Represents a RegistrationInfo definition. @@ -3350,181 +4657,54 @@ def __init__( self.token = token -class ResourceModelWithAllowedPropertySetIdentity(Identity): # pylint: disable=name-too-long - """ResourceModelWithAllowedPropertySetIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. The value must be an UUID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. The value must be an UUID. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - -class ResourceModelWithAllowedPropertySetPlan(Plan): - """ResourceModelWithAllowedPropertySetPlan. - - 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 - :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 - """ - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to server. +class ResourceProviderOperation(_serialization.Model): + """Supported operation of this resource provider. - :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. :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 display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + :ivar is_data_action: Is a data action. + :vartype is_data_action: bool + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties """ - _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"}, + "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "properties": {"key": "properties", "type": "OperationProperties"}, } def __init__( self, *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, + name: Optional[str] = None, + display: Optional["_models.ResourceProviderOperationDisplay"] = None, + is_data_action: Optional[bool] = None, + properties: Optional["_models.OperationProperties"] = None, **kwargs: Any ) -> None: """ - :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. :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 display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + :keyword is_data_action: Is a data action. + :paramtype is_data_action: bool + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties """ super().__init__(**kwargs) self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - + self.display = display + self.is_data_action = is_data_action + self.properties = properties -class ResourceModelWithAllowedPropertySetSku(Sku): - """ResourceModelWithAllowedPropertySetSku. - 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 - """ - - -class ResourceProviderOperation(_serialization.Model): - """Supported operation of this resource provider. - - :ivar name: Operation name, in format of {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Display metadata associated with the operation. - :vartype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay - :ivar is_data_action: Is a data action. - :vartype is_data_action: bool - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "properties": {"key": "properties", "type": "OperationProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.ResourceProviderOperationDisplay"] = None, - is_data_action: Optional[bool] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name, in format of {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display metadata associated with the operation. - :paramtype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay - :keyword is_data_action: Is a data action. - :paramtype is_data_action: bool - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.is_data_action = is_data_action - self.properties = properties - - -class ResourceProviderOperationDisplay(_serialization.Model): - """Display metadata associated with the operation. +class ResourceProviderOperationDisplay(_serialization.Model): + """Display metadata associated with the operation. :ivar provider: Resource provider: Microsoft Desktop Virtualization. :vartype provider: str @@ -3569,19 +4749,20 @@ def __init__( self.description = description -class ResourceProviderOperationList(_serialization.Model): - """Result of the request to list operations. +class ResourceProviderOperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar value: List of operations supported by this resource provider. + :ivar value: The ResourceProviderOperation items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3589,14 +4770,18 @@ class ResourceProviderOperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ResourceProviderOperation"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ResourceProviderOperation"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of operations supported by this resource provider. + :keyword value: The ResourceProviderOperation items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class ScalingHostPoolReference(_serialization.Model): @@ -3627,7 +4812,7 @@ def __init__( self.scaling_plan_enabled = scaling_plan_enabled -class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many-instance-attributes +class ScalingPlan(TrackedResource): """Represents a scaling plan definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -3649,28 +4834,26 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar etag: If etag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in 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 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, + the resource provider must validate and persist this value. + :vartype kind: 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 mode deployment will not delete the resource if it is removed from the template since it is 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, - 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 - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - 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 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 plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku :ivar object_id: ObjectId of scaling plan. (internal use). :vartype object_id: str :ivar description: Description of scaling plan. @@ -3679,7 +4862,7 @@ 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 @@ -3696,8 +4879,8 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "object_id": {"readonly": True}, "time_zone": {"required": True}, } @@ -3709,12 +4892,12 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "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"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "plan": {"key": "plan", "type": "Plan"}, + "sku": {"key": "sku", "type": "Sku"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -3731,11 +4914,11 @@ def __init__( location: str, time_zone: str, tags: Optional[Dict[str, str]] = None, - managed_by: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + managed_by: Optional[str] = None, + plan: Optional["_models.Plan"] = None, + sku: Optional["_models.Sku"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, host_pool_type: Union[str, "_models.ScalingHostPoolType"] = "Pooled", @@ -3749,30 +4932,28 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :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, + the resource provider must validate and persist this value. + :paramtype kind: 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, complete mode deployment will not delete the resource if it is removed from the template since 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, - the resource provider must validate and persist this value. - :paramtype kind: 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 plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku :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 @@ -3782,16 +4963,13 @@ def __init__( :paramtype host_pool_references: list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ - super().__init__( - tags=tags, - location=location, - managed_by=managed_by, - kind=kind, - identity=identity, - sku=sku, - plan=plan, - **kwargs - ) + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.etag = None + self.kind = kind + self.managed_by = managed_by + self.plan = plan + self.sku = sku self.object_id = None self.description = description self.friendly_name = friendly_name @@ -3805,16 +4983,16 @@ def __init__( class ScalingPlanList(_serialization.Model): """List of scaling plan definitions. - 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 value: List of scaling plan definitions. + :ivar value: The ScalingPlan items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlan] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -3822,14 +5000,16 @@ class ScalingPlanList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ScalingPlan"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.ScalingPlan"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of scaling plan definitions. + :keyword value: The ScalingPlan items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlan] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class ScalingPlanPatch(_serialization.Model): @@ -3837,6 +5017,36 @@ class ScalingPlanPatch(_serialization.Model): :ivar tags: tags to be updated. :vartype tags: dict[str, str] + :ivar properties: Detailed properties for scaling plan. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatchProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "ScalingPlanPatchProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ScalingPlanPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: Detailed properties for scaling plan. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatchProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class ScalingPlanPatchProperties(_serialization.Model): + """Scaling plan properties. + :ivar description: Description of scaling plan. :vartype description: str :ivar friendly_name: User friendly name of scaling plan. @@ -3853,19 +5063,17 @@ class ScalingPlanPatch(_serialization.Model): """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "time_zone": {"key": "properties.timeZone", "type": "str"}, - "exclusion_tag": {"key": "properties.exclusionTag", "type": "str"}, - "schedules": {"key": "properties.schedules", "type": "[ScalingSchedule]"}, - "host_pool_references": {"key": "properties.hostPoolReferences", "type": "[ScalingHostPoolReference]"}, + "description": {"key": "description", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "exclusion_tag": {"key": "exclusionTag", "type": "str"}, + "schedules": {"key": "schedules", "type": "[ScalingSchedule]"}, + "host_pool_references": {"key": "hostPoolReferences", "type": "[ScalingHostPoolReference]"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, time_zone: Optional[str] = None, @@ -3875,8 +5083,6 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] :keyword description: Description of scaling plan. :paramtype description: str :keyword friendly_name: User friendly name of scaling plan. @@ -3892,7 +5098,6 @@ def __init__( list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ super().__init__(**kwargs) - self.tags = tags self.description = description self.friendly_name = friendly_name self.time_zone = time_zone @@ -3901,11 +5106,13 @@ def __init__( self.host_pool_references = host_pool_references -class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-instance-attributes +class ScalingPlanPersonalSchedule(ProxyResource): """Represents a ScalingPlanPersonalSchedule 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 @@ -3917,9 +5124,9 @@ class ScalingPlanPersonalSchedule(ProxyResource): # pylint: disable=too-many-in :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". @@ -3944,7 +5151,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". @@ -3964,7 +5171,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". @@ -3984,7 +5191,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". @@ -4011,12 +5218,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}, } @@ -4060,27 +5272,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, @@ -4089,9 +5301,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". @@ -4116,7 +5328,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". @@ -4136,7 +5348,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". @@ -4156,7 +5368,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". @@ -4209,16 +5421,16 @@ def __init__( # pylint: disable=too-many-locals class ScalingPlanPersonalScheduleList(_serialization.Model): """List of ScalingPlanPersonalSchedule definitions. - 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 value: List of ScalingPlanPersonalSchedule definitions. + :ivar value: The ScalingPlanPersonalSchedule items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4226,17 +5438,45 @@ class ScalingPlanPersonalScheduleList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ScalingPlanPersonalSchedule"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ScalingPlanPersonalSchedule"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of ScalingPlanPersonalSchedule definitions. + :keyword value: The ScalingPlanPersonalSchedule items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link + + +class ScalingPlanPersonalSchedulePatch(_serialization.Model): + """ScalingPlanPersonalSchedule properties that can be patched. + + :ivar properties: Detailed properties for ScalingPlanPersonalSchedule. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatchProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ScalingPlanPersonalSchedulePatchProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ScalingPlanPersonalSchedulePatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Detailed properties for ScalingPlanPersonalSchedule. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatchProperties + """ + super().__init__(**kwargs) + self.properties = properties -class ScalingPlanPersonalSchedulePatch(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ScalingPlanPersonalSchedulePatchProperties(_serialization.Model): # pylint: disable=name-too-long """ScalingPlanPersonalSchedule properties that can be patched. :ivar days_of_week: Set of days of the week on which this schedule is active. @@ -4340,35 +5580,32 @@ class ScalingPlanPersonalSchedulePatch(_serialization.Model): # pylint: disable } _attribute_map = { - "days_of_week": {"key": "properties.daysOfWeek", "type": "[str]"}, - "ramp_up_start_time": {"key": "properties.rampUpStartTime", "type": "Time"}, - "ramp_up_auto_start_hosts": {"key": "properties.rampUpAutoStartHosts", "type": "str"}, - "ramp_up_start_vm_on_connect": {"key": "properties.rampUpStartVMOnConnect", "type": "str"}, - "ramp_up_action_on_disconnect": {"key": "properties.rampUpActionOnDisconnect", "type": "str"}, - "ramp_up_minutes_to_wait_on_disconnect": {"key": "properties.rampUpMinutesToWaitOnDisconnect", "type": "int"}, - "ramp_up_action_on_logoff": {"key": "properties.rampUpActionOnLogoff", "type": "str"}, - "ramp_up_minutes_to_wait_on_logoff": {"key": "properties.rampUpMinutesToWaitOnLogoff", "type": "int"}, - "peak_start_time": {"key": "properties.peakStartTime", "type": "Time"}, - "peak_start_vm_on_connect": {"key": "properties.peakStartVMOnConnect", "type": "str"}, - "peak_action_on_disconnect": {"key": "properties.peakActionOnDisconnect", "type": "str"}, - "peak_minutes_to_wait_on_disconnect": {"key": "properties.peakMinutesToWaitOnDisconnect", "type": "int"}, - "peak_action_on_logoff": {"key": "properties.peakActionOnLogoff", "type": "str"}, - "peak_minutes_to_wait_on_logoff": {"key": "properties.peakMinutesToWaitOnLogoff", "type": "int"}, - "ramp_down_start_time": {"key": "properties.rampDownStartTime", "type": "Time"}, - "ramp_down_start_vm_on_connect": {"key": "properties.rampDownStartVMOnConnect", "type": "str"}, - "ramp_down_action_on_disconnect": {"key": "properties.rampDownActionOnDisconnect", "type": "str"}, - "ramp_down_minutes_to_wait_on_disconnect": { - "key": "properties.rampDownMinutesToWaitOnDisconnect", - "type": "int", - }, - "ramp_down_action_on_logoff": {"key": "properties.rampDownActionOnLogoff", "type": "str"}, - "ramp_down_minutes_to_wait_on_logoff": {"key": "properties.rampDownMinutesToWaitOnLogoff", "type": "int"}, - "off_peak_start_time": {"key": "properties.offPeakStartTime", "type": "Time"}, - "off_peak_start_vm_on_connect": {"key": "properties.offPeakStartVMOnConnect", "type": "str"}, - "off_peak_action_on_disconnect": {"key": "properties.offPeakActionOnDisconnect", "type": "str"}, - "off_peak_minutes_to_wait_on_disconnect": {"key": "properties.offPeakMinutesToWaitOnDisconnect", "type": "int"}, - "off_peak_action_on_logoff": {"key": "properties.offPeakActionOnLogoff", "type": "str"}, - "off_peak_minutes_to_wait_on_logoff": {"key": "properties.offPeakMinutesToWaitOnLogoff", "type": "int"}, + "days_of_week": {"key": "daysOfWeek", "type": "[str]"}, + "ramp_up_start_time": {"key": "rampUpStartTime", "type": "Time"}, + "ramp_up_auto_start_hosts": {"key": "rampUpAutoStartHosts", "type": "str"}, + "ramp_up_start_vm_on_connect": {"key": "rampUpStartVMOnConnect", "type": "str"}, + "ramp_up_action_on_disconnect": {"key": "rampUpActionOnDisconnect", "type": "str"}, + "ramp_up_minutes_to_wait_on_disconnect": {"key": "rampUpMinutesToWaitOnDisconnect", "type": "int"}, + "ramp_up_action_on_logoff": {"key": "rampUpActionOnLogoff", "type": "str"}, + "ramp_up_minutes_to_wait_on_logoff": {"key": "rampUpMinutesToWaitOnLogoff", "type": "int"}, + "peak_start_time": {"key": "peakStartTime", "type": "Time"}, + "peak_start_vm_on_connect": {"key": "peakStartVMOnConnect", "type": "str"}, + "peak_action_on_disconnect": {"key": "peakActionOnDisconnect", "type": "str"}, + "peak_minutes_to_wait_on_disconnect": {"key": "peakMinutesToWaitOnDisconnect", "type": "int"}, + "peak_action_on_logoff": {"key": "peakActionOnLogoff", "type": "str"}, + "peak_minutes_to_wait_on_logoff": {"key": "peakMinutesToWaitOnLogoff", "type": "int"}, + "ramp_down_start_time": {"key": "rampDownStartTime", "type": "Time"}, + "ramp_down_start_vm_on_connect": {"key": "rampDownStartVMOnConnect", "type": "str"}, + "ramp_down_action_on_disconnect": {"key": "rampDownActionOnDisconnect", "type": "str"}, + "ramp_down_minutes_to_wait_on_disconnect": {"key": "rampDownMinutesToWaitOnDisconnect", "type": "int"}, + "ramp_down_action_on_logoff": {"key": "rampDownActionOnLogoff", "type": "str"}, + "ramp_down_minutes_to_wait_on_logoff": {"key": "rampDownMinutesToWaitOnLogoff", "type": "int"}, + "off_peak_start_time": {"key": "offPeakStartTime", "type": "Time"}, + "off_peak_start_vm_on_connect": {"key": "offPeakStartVMOnConnect", "type": "str"}, + "off_peak_action_on_disconnect": {"key": "offPeakActionOnDisconnect", "type": "str"}, + "off_peak_minutes_to_wait_on_disconnect": {"key": "offPeakMinutesToWaitOnDisconnect", "type": "int"}, + "off_peak_action_on_logoff": {"key": "offPeakActionOnLogoff", "type": "str"}, + "off_peak_minutes_to_wait_on_logoff": {"key": "offPeakMinutesToWaitOnLogoff", "type": "int"}, } def __init__( # pylint: disable=too-many-locals @@ -4520,11 +5757,13 @@ def __init__( # pylint: disable=too-many-locals self.off_peak_minutes_to_wait_on_logoff = off_peak_minutes_to_wait_on_logoff -class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance-attributes +class ScalingPlanPooledSchedule(ProxyResource): """Represents a ScalingPlanPooledSchedule 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 @@ -4536,9 +5775,11 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- :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". @@ -4546,15 +5787,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". @@ -4562,7 +5803,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 @@ -4575,7 +5816,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". @@ -4588,10 +5829,15 @@ class ScalingPlanPooledSchedule(Resource): # pylint: disable=too-many-instance- "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"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 = { @@ -4599,6 +5845,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"}, @@ -4621,29 +5868,32 @@ 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", + name_properties_name: Optional[str] = None, 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 name_properties_name: Name of the ScalingPlanPooledSchedule. + :paramtype name_properties_name: str + :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". @@ -4651,15 +5901,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". @@ -4667,7 +5917,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 @@ -4681,7 +5931,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". @@ -4689,6 +5939,7 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ super().__init__(**kwargs) + self.name_properties_name = name_properties_name 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 @@ -4711,16 +5962,16 @@ def __init__( class ScalingPlanPooledScheduleList(_serialization.Model): """List of ScalingPlanPooledSchedule definitions. - 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 value: List of ScalingPlanPooledSchedule definitions. + :ivar value: The ScalingPlanPooledSchedule items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -4728,17 +5979,21 @@ class ScalingPlanPooledScheduleList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ScalingPlanPooledSchedule"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ScalingPlanPooledSchedule"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of ScalingPlanPooledSchedule definitions. + :keyword value: The ScalingPlanPooledSchedule items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-instance-attributes +class ScalingPlanPooledSchedulePatch(Resource): """ScalingPlanPooledSchedule properties that can be patched. Variables are only populated by the server, and will be ignored when sending a request. @@ -4754,16 +6009,53 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst :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. - :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 - values are: "BreadthFirst" and "DepthFirst". - :vartype ramp_up_load_balancing_algorithm: str or - ~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 properties: Detailed properties for ScalingPlanPooledSchedule. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatchProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "ScalingPlanPooledSchedulePatchProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ScalingPlanPooledSchedulePatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Detailed properties for ScalingPlanPooledSchedule. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ScalingPlanPooledSchedulePatchProperties(_serialization.Model): + """A ScalingPlanPooledSchedule that can be patched. + + :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.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 + values are: "BreadthFirst" and "DepthFirst". + :vartype ramp_up_load_balancing_algorithm: str or + ~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. :vartype ramp_up_capacity_threshold_pct: int :ivar peak_start_time: Starting time for peak period. @@ -4802,10 +6094,6 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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}, @@ -4813,32 +6101,30 @@ class ScalingPlanPooledSchedulePatch(Resource): # pylint: disable=too-many-inst } _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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"}, - "ramp_up_minimum_hosts_pct": {"key": "properties.rampUpMinimumHostsPct", "type": "int"}, - "ramp_up_capacity_threshold_pct": {"key": "properties.rampUpCapacityThresholdPct", "type": "int"}, - "peak_start_time": {"key": "properties.peakStartTime", "type": "Time"}, - "peak_load_balancing_algorithm": {"key": "properties.peakLoadBalancingAlgorithm", "type": "str"}, - "ramp_down_start_time": {"key": "properties.rampDownStartTime", "type": "Time"}, - "ramp_down_load_balancing_algorithm": {"key": "properties.rampDownLoadBalancingAlgorithm", "type": "str"}, - "ramp_down_minimum_hosts_pct": {"key": "properties.rampDownMinimumHostsPct", "type": "int"}, - "ramp_down_capacity_threshold_pct": {"key": "properties.rampDownCapacityThresholdPct", "type": "int"}, - "ramp_down_force_logoff_users": {"key": "properties.rampDownForceLogoffUsers", "type": "bool"}, - "ramp_down_stop_hosts_when": {"key": "properties.rampDownStopHostsWhen", "type": "str"}, - "ramp_down_wait_time_minutes": {"key": "properties.rampDownWaitTimeMinutes", "type": "int"}, - "ramp_down_notification_message": {"key": "properties.rampDownNotificationMessage", "type": "str"}, - "off_peak_start_time": {"key": "properties.offPeakStartTime", "type": "Time"}, - "off_peak_load_balancing_algorithm": {"key": "properties.offPeakLoadBalancingAlgorithm", "type": "str"}, + "days_of_week": {"key": "daysOfWeek", "type": "[str]"}, + "ramp_up_start_time": {"key": "rampUpStartTime", "type": "Time"}, + "ramp_up_load_balancing_algorithm": {"key": "rampUpLoadBalancingAlgorithm", "type": "str"}, + "ramp_up_minimum_hosts_pct": {"key": "rampUpMinimumHostsPct", "type": "int"}, + "ramp_up_capacity_threshold_pct": {"key": "rampUpCapacityThresholdPct", "type": "int"}, + "peak_start_time": {"key": "peakStartTime", "type": "Time"}, + "peak_load_balancing_algorithm": {"key": "peakLoadBalancingAlgorithm", "type": "str"}, + "ramp_down_start_time": {"key": "rampDownStartTime", "type": "Time"}, + "ramp_down_load_balancing_algorithm": {"key": "rampDownLoadBalancingAlgorithm", "type": "str"}, + "ramp_down_minimum_hosts_pct": {"key": "rampDownMinimumHostsPct", "type": "int"}, + "ramp_down_capacity_threshold_pct": {"key": "rampDownCapacityThresholdPct", "type": "int"}, + "ramp_down_force_logoff_users": {"key": "rampDownForceLogoffUsers", "type": "bool"}, + "ramp_down_stop_hosts_when": {"key": "rampDownStopHostsWhen", "type": "str"}, + "ramp_down_wait_time_minutes": {"key": "rampDownWaitTimeMinutes", "type": "int"}, + "ramp_down_notification_message": {"key": "rampDownNotificationMessage", "type": "str"}, + "off_peak_start_time": {"key": "offPeakStartTime", "type": "Time"}, + "off_peak_load_balancing_algorithm": {"key": "offPeakLoadBalancingAlgorithm", "type": "str"}, } def __init__( self, *, + name: Optional[str] = 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, @@ -4859,6 +6145,8 @@ def __init__( **kwargs: Any ) -> None: """ + :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.DayOfWeek] :keyword ramp_up_start_time: Starting time for ramp up period. @@ -4907,6 +6195,7 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ super().__init__(**kwargs) + self.name = name 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 @@ -4926,14 +6215,13 @@ def __init__( self.off_peak_load_balancing_algorithm = off_peak_load_balancing_algorithm -class ScalingSchedule(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ScalingSchedule(_serialization.Model): """A ScalingPlanPooledSchedule. :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 @@ -5011,7 +6299,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, @@ -5034,8 +6322,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 @@ -5102,6 +6389,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. 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 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. @@ -5150,7 +6519,7 @@ def __init__(self, *, log_specifications: Optional[List["_models.LogSpecificatio self.log_specifications = log_specifications -class SessionHost(Resource): # pylint: disable=too-many-instance-attributes +class SessionHost(ProxyResource): """Represents a SessionHost definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -5202,6 +6571,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] @@ -5216,7 +6590,10 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "virtual_machine_id": {"readonly": True}, "resource_id": {"readonly": True}, "status_timestamp": {"readonly": True}, + "update_state": {"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}, } @@ -5241,6 +6618,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]", @@ -5259,7 +6638,6 @@ def __init__( status: Optional[Union[str, "_models.Status"]] = None, os_version: Optional[str] = None, sx_s_stack_version: Optional[str] = None, - update_state: Optional[Union[str, "_models.UpdateState"]] = None, update_error_message: Optional[str] = None, **kwargs: Any ) -> None: @@ -5285,9 +6663,6 @@ def __init__( :paramtype os_version: str :keyword sx_s_stack_version: The version of the side by side stack on the session host. :paramtype sx_s_stack_version: str - :keyword update_state: Update state of a SessionHost. Known values are: "Initial", "Pending", - "Started", "Succeeded", and "Failed". - :paramtype update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState :keyword update_error_message: The error message. :paramtype update_error_message: str """ @@ -5305,12 +6680,389 @@ def __init__( self.status_timestamp = None self.os_version = os_version self.sx_s_stack_version = sx_s_stack_version - self.update_state = update_state + self.update_state = None 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(ProxyResource): + """Schema for SessionHostConfiguration 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 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. + :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.NetworkInfoProperties + :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.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. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. + :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.". + :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": {"max_length": 11}, + } + + _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, + *, + 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.NetworkInfoProperties"] = None, + vm_size_id: Optional[str] = None, + disk_info: Optional["_models.DiskInfoProperties"] = None, + custom_configuration_script_url: Optional[str] = None, + image_info: Optional["_models.ImageInfoProperties"] = None, + domain_info: Optional["_models.DomainInfoProperties"] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + vm_admin_credentials: Optional["_models.KeyVaultCredentialsProperties"] = 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. + :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.NetworkInfoProperties + :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.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. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. + :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.". + :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. + + All required parameters must be populated in order to send to server. + + :ivar value: The SessionHostConfiguration items on this page. Required. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SessionHostConfiguration"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SessionHostConfiguration items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SessionHostConfigurationPatch(_serialization.Model): + """SessionHostConfiguration properties that can be patched. + + :ivar properties: Detailed properties for SessionHostConfiguration. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatchProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "SessionHostConfigurationPatchProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SessionHostConfigurationPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Detailed properties for SessionHostConfiguration. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SessionHostConfigurationPatchProperties(_serialization.Model): + """Session host configurations of HostPool. + + :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. + :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}, + } + + _attribute_map = { + "friendly_name": {"key": "friendlyName", "type": "str"}, + "vm_tags": {"key": "vmTags", "type": "{str}"}, + "vm_location": {"key": "vmLocation", "type": "str"}, + "vm_resource_group": {"key": "vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[int]"}, + "network_info": {"key": "networkInfo", "type": "NetworkInfoPatchProperties"}, + "vm_size_id": {"key": "vmSizeId", "type": "str"}, + "disk_info": {"key": "diskInfo", "type": "DiskInfoPatchProperties"}, + "custom_configuration_script_url": {"key": "customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "imageInfo", "type": "ImageInfoPatchProperties"}, + "domain_info": {"key": "domainInfo", "type": "DomainInfoPatchProperties"}, + "security_info": {"key": "securityInfo", "type": "SecurityInfoPatchProperties"}, + "vm_admin_credentials": {"key": "vmAdminCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + "boot_diagnostics_info": {"key": "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. 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. + :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): """Contains details on the failure. @@ -5389,16 +7141,16 @@ def __init__(self, **kwargs: Any) -> None: class SessionHostList(_serialization.Model): """List of SessionHost definitions. - 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 value: List of SessionHost definitions. + :ivar value: The SessionHost items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHost] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -5406,18 +7158,529 @@ class SessionHostList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SessionHost"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SessionHost"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The SessionHost items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHost] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SessionHostManagement(ProxyResource): + """Schema for SessionHostManagement 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 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. + + All required parameters must be populated in order to send to server. + + :ivar value: The SessionHostManagement items on this page. Required. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionHostManagement]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SessionHostManagement"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SessionHostManagement items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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): + """SessionHostManagement properties that can be patched. + + :ivar properties: Detailed properties for SessionHostManagement. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatchProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "SessionHostManagementPatchProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SessionHostManagementPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Detailed properties for SessionHostManagement. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SessionHostManagementPatchProperties(_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": "scheduledDateTimeZone", "type": "str"}, + "update": {"key": "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): + """Schema for SessionHostManagementUpdateStatus 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 ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: 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 status: Operation status. Current defined values are < Error | Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | + Succeeded | Failed | Canceled. Required. Known values are: "Error", "Scheduled", + "UpdatingSessionHosts", "ValidatingSessionHostUpdate", "Paused", "Pausing", "Cancelling", + "Succeeded", "Failed", and "Cancelled". + :vartype status: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateOperationStatus + :ivar properties: Properties bag to hold custom RP properties for sessionHostManagement Update + Statuses. + :vartype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatusProperties + """ + + _validation = { + "percent_complete": {"maximum": 100, "minimum": 0}, + "status": {"required": True, "readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "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"}, + "status": {"key": "status", "type": "str"}, + "properties": {"key": "properties", "type": "SessionHostManagementUpdateStatusProperties"}, + } + + def __init__( + self, + *, + 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, + properties: Optional["_models.SessionHostManagementUpdateStatusProperties"] = 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 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 properties: Properties bag to hold custom RP properties for sessionHostManagement + Update Statuses. + :paramtype properties: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatusProperties + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.error = error + self.status = None + self.properties = properties + + +class SessionHostManagementUpdateStatusProperties(_serialization.Model): # pylint: disable=name-too-long + """The current status of the session host update async operation. + + :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 + """ + + _attribute_map = { + "correlation_id": {"key": "correlationId", "type": "str"}, + "progress": {"key": "progress", "type": "SessionHostManagementOperationProgress"}, + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + "session_host_management": {"key": "sessionHostManagement", "type": "SessionHostManagement"}, + } + + def __init__( + self, + *, + 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 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.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. 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 properties: Detailed properties for SessionHost. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.SessionHostPatchProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "SessionHostPatchProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SessionHostPatchProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Detailed properties for SessionHost. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.SessionHostPatchProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SessionHostPatchProperties(_serialization.Model): + """SessionHost properties that can be patched. + + :ivar allow_new_session: Allow a new session. + :vartype allow_new_session: bool + :ivar assigned_user: User assigned to SessionHost. + :vartype assigned_user: str + :ivar friendly_name: Friendly name of SessionHost. + :vartype friendly_name: str + """ + + _attribute_map = { + "allow_new_session": {"key": "allowNewSession", "type": "bool"}, + "assigned_user": {"key": "assignedUser", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + } + + def __init__( + self, + *, + allow_new_session: Optional[bool] = None, + assigned_user: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword allow_new_session: Allow a new session. + :paramtype allow_new_session: bool + :keyword assigned_user: User assigned to SessionHost. + :paramtype assigned_user: str + :keyword friendly_name: Friendly name of SessionHost. + :paramtype friendly_name: str + """ + super().__init__(**kwargs) + self.allow_new_session = allow_new_session + self.assigned_user = assigned_user + 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 value: List of SessionHost definitions. - :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHost] + :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.value = value - self.next_link = None + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity -class SessionHostPatch(Resource): - """SessionHost properties that can be patched. +class StartMenuItem(Resource): + """Represents a StartMenuItem definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -5432,12 +7695,8 @@ class SessionHostPatch(Resource): :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. - :vartype assigned_user: str - :ivar friendly_name: Friendly name of SessionHost. - :vartype friendly_name: str + :ivar properties: Detailed properties for StartMenuItem. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.StartMenuItemProperties """ _validation = { @@ -5452,49 +7711,53 @@ class SessionHostPatch(Resource): "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"}, + "properties": {"key": "properties", "type": "StartMenuItemProperties"}, } - def __init__( - self, - *, - allow_new_session: Optional[bool] = None, - assigned_user: Optional[str] = None, - friendly_name: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.StartMenuItemProperties"] = None, **kwargs: Any) -> None: """ - :keyword allow_new_session: Allow a new session. - :paramtype allow_new_session: bool - :keyword assigned_user: User assigned to SessionHost. - :paramtype assigned_user: str - :keyword friendly_name: Friendly name of SessionHost. - :paramtype friendly_name: str + :keyword properties: Detailed properties for StartMenuItem. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.StartMenuItemProperties """ super().__init__(**kwargs) - self.allow_new_session = allow_new_session - self.assigned_user = assigned_user - self.friendly_name = friendly_name + self.properties = properties -class StartMenuItem(Resource): - """Represents a StartMenuItem definition. +class StartMenuItemList(_serialization.Model): + """List of StartMenuItem definitions. - 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 value: The StartMenuItem items on this page. Required. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[StartMenuItem]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.StartMenuItem"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The StartMenuItem items on this page. Required. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class StartMenuItemProperties(_serialization.Model): + """Schema for StartMenuItem properties. - :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. @@ -5507,23 +7770,12 @@ class StartMenuItem(Resource): :vartype icon_index: int """ - _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"}, - "app_alias": {"key": "properties.appAlias", "type": "str"}, - "file_path": {"key": "properties.filePath", "type": "str"}, - "command_line_arguments": {"key": "properties.commandLineArguments", "type": "str"}, - "icon_path": {"key": "properties.iconPath", "type": "str"}, - "icon_index": {"key": "properties.iconIndex", "type": "int"}, + "app_alias": {"key": "appAlias", "type": "str"}, + "file_path": {"key": "filePath", "type": "str"}, + "command_line_arguments": {"key": "commandLineArguments", "type": "str"}, + "icon_path": {"key": "iconPath", "type": "str"}, + "icon_index": {"key": "iconIndex", "type": "int"}, } def __init__( @@ -5556,36 +7808,6 @@ def __init__( self.icon_index = icon_index -class StartMenuItemList(_serialization.Model): - """List of StartMenuItem definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of StartMenuItem definitions. - :vartype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] - :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": "[StartMenuItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.StartMenuItem"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of StartMenuItem definitions. - :paramtype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -5683,7 +7905,82 @@ def __init__(self, *, hour: int, minute: int, **kwargs: Any) -> None: self.minute = minute -class UserSession(Resource): +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(ProxyResource): """Represents a UserSession definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -5772,16 +8069,16 @@ def __init__( class UserSessionList(_serialization.Model): """List of UserSession definitions. - 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 value: List of UserSession definitions. + :ivar value: The UserSession items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.UserSession] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -5789,17 +8086,19 @@ class UserSessionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UserSession"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.UserSession"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of UserSession definitions. + :keyword value: The UserSession items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.UserSession] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many-instance-attributes +class Workspace(TrackedResource): """Represents a Workspace definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -5821,28 +8120,26 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar etag: If etag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in 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 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, + the resource provider must validate and persist this value. + :vartype kind: 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 mode deployment will not delete the resource if it is removed from the template since it is 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, - 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 - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - 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 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 plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :ivar sku: The SKU (Stock Keeping Unit) assigned to this resource. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku :ivar object_id: ObjectId of Workspace. (internal use). :vartype object_id: str :ivar description: Description of Workspace. @@ -5870,8 +8167,8 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "etag": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, "object_id": {"readonly": True}, "cloud_pc_resource": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -5884,12 +8181,12 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "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"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "plan": {"key": "plan", "type": "Plan"}, + "sku": {"key": "sku", "type": "Sku"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -5907,11 +8204,11 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - managed_by: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + managed_by: Optional[str] = None, + plan: Optional["_models.Plan"] = None, + sku: Optional["_models.Sku"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, application_group_references: Optional[List[str]] = None, @@ -5923,23 +8220,21 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :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, + the resource provider must validate and persist this value. + :paramtype kind: 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, complete mode deployment will not delete the resource if it is removed from the template since 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, - the resource provider must validate and persist this value. - :paramtype kind: 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 plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan + :keyword sku: The SKU (Stock Keeping Unit) assigned to this resource. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku :keyword description: Description of Workspace. :paramtype description: str :keyword friendly_name: Friendly name of Workspace. @@ -5952,16 +8247,13 @@ def __init__( :paramtype public_network_access: str or ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess """ - super().__init__( - tags=tags, - location=location, - managed_by=managed_by, - kind=kind, - identity=identity, - sku=sku, - plan=plan, - **kwargs - ) + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.etag = None + self.kind = kind + self.managed_by = managed_by + self.plan = plan + self.sku = sku self.object_id = None self.description = description self.friendly_name = friendly_name @@ -5974,16 +8266,16 @@ def __init__( class WorkspaceList(_serialization.Model): """List of Workspace definitions. - 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 value: List of Workspace definitions. + :ivar value: The Workspace items on this page. Required. :vartype value: list[~azure.mgmt.desktopvirtualization.models.Workspace] - :ivar next_link: Link to the next page of results. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -5991,21 +8283,53 @@ class WorkspaceList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Workspace"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Workspace"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: List of Workspace definitions. + :keyword value: The Workspace items on this page. Required. :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Workspace] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class WorkspacePatch(_serialization.Model): - """Workspace properties that can be patched. + """Workspace properties that can be patched.A patch model. :ivar tags: tags to be updated. :vartype tags: dict[str, str] + :ivar properties: Detailed properties for Workspace. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.WorkspacePatchProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "WorkspacePatchProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.WorkspacePatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] + :keyword properties: Detailed properties for Workspace. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.WorkspacePatchProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class WorkspacePatchProperties(_serialization.Model): + """Workspace properties that can be patched. + :ivar description: Description of Workspace. :vartype description: str :ivar friendly_name: Friendly name of Workspace. @@ -6019,17 +8343,15 @@ class WorkspacePatch(_serialization.Model): """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "application_group_references": {"key": "properties.applicationGroupReferences", "type": "[str]"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "application_group_references": {"key": "applicationGroupReferences", "type": "[str]"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, application_group_references: Optional[List[str]] = None, @@ -6037,8 +8359,6 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword tags: tags to be updated. - :paramtype tags: dict[str, str] :keyword description: Description of Workspace. :paramtype description: str :keyword friendly_name: Friendly name of Workspace. @@ -6051,7 +8371,6 @@ def __init__( ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess """ super().__init__(**kwargs) - self.tags = tags self.description = description self.friendly_name = friendly_name self.application_group_references = application_group_references 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 df927dd95440..2847416f8466 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 @@ -5,49 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._scaling_plans_operations import ScalingPlansOperations -from ._scaling_plan_pooled_schedules_operations import ScalingPlanPooledSchedulesOperations -from ._scaling_plan_personal_schedules_operations import ScalingPlanPersonalSchedulesOperations -from ._application_groups_operations import ApplicationGroupsOperations -from ._start_menu_items_operations import StartMenuItemsOperations -from ._applications_operations import ApplicationsOperations -from ._desktops_operations import DesktopsOperations -from ._host_pools_operations import HostPoolsOperations -from ._user_sessions_operations import UserSessionsOperations -from ._session_hosts_operations import SessionHostsOperations -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._app_attach_package_operations import AppAttachPackageOperations # type: ignore +from ._application_groups_operations import ApplicationGroupsOperations # type: ignore +from ._host_pools_operations import HostPoolsOperations # type: ignore +from ._scaling_plans_operations import ScalingPlansOperations # type: ignore +from ._workspaces_operations import WorkspacesOperations # type: ignore +from ._applications_operations import ApplicationsOperations # type: ignore +from ._desktops_operations import DesktopsOperations # type: ignore +from ._start_menu_items_operations import StartMenuItemsOperations # type: ignore +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations # type: ignore +from ._msix_images_operations import MsixImagesOperations # type: ignore +from ._app_attach_package_info_operations import AppAttachPackageInfoOperations # type: ignore +from ._msix_packages_operations import MSIXPackagesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._session_host_configurations_operations import SessionHostConfigurationsOperations # type: ignore +from ._session_host_managements_operations import SessionHostManagementsOperations # type: ignore +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations # type: ignore +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations # type: ignore +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations # type: ignore +from ._session_hosts_operations import SessionHostsOperations # type: ignore +from ._user_sessions_operations import UserSessionsOperations # type: ignore +from ._scaling_plan_personal_schedules_operations import ScalingPlanPersonalSchedulesOperations # type: ignore +from ._scaling_plan_pooled_schedules_operations import ScalingPlanPooledSchedulesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", - "WorkspacesOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "ScalingPlansOperations", - "ScalingPlanPooledSchedulesOperations", - "ScalingPlanPersonalSchedulesOperations", + "AppAttachPackageOperations", "ApplicationGroupsOperations", - "StartMenuItemsOperations", + "HostPoolsOperations", + "ScalingPlansOperations", + "WorkspacesOperations", "ApplicationsOperations", "DesktopsOperations", - "HostPoolsOperations", - "UserSessionsOperations", - "SessionHostsOperations", - "MSIXPackagesOperations", - "AppAttachPackageInfoOperations", + "StartMenuItemsOperations", + "ActiveSessionHostConfigurationsOperations", "MsixImagesOperations", - "AppAttachPackageOperations", + "AppAttachPackageInfoOperations", + "MSIXPackagesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "SessionHostConfigurationsOperations", + "SessionHostManagementsOperations", + "ControlSessionHostUpdateOperations", + "InitiateSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostsOperations", + "UserSessionsOperations", + "ScalingPlanPersonalSchedulesOperations", + "ScalingPlanPooledSchedulesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/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..bacdb681d3fa --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,272 @@ +# 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, 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 +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_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=64, 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="GET", 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}/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=64, 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="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 list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ActiveSessionHostConfiguration"]: + """Operation to list the ActiveSessionHostConfigurations 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: 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 = { + 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) + 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 get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get a ActiveSessionHostConfiguration. + + :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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", 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/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py index 077e07be9440..dbaf7bfb007a 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +45,7 @@ def build_import_method_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", "2024-04-03")) + 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") @@ -102,7 +101,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: _models.ImportPackageInfoRequest, + import_package_info_request: Optional[_models.ImportPackageInfoRequest] = None, *, content_type: str = "application/json", **kwargs: Any @@ -114,8 +113,7 @@ def import_method( :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. + :param import_package_info_request: Default value is None. :type import_package_info_request: ~azure.mgmt.desktopvirtualization.models.ImportPackageInfoRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -131,7 +129,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: IO[bytes], + import_package_info_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -143,8 +141,7 @@ def import_method( :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. + :param import_package_info_request: Default value is None. :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". @@ -159,7 +156,7 @@ def import_method( self, resource_group_name: str, host_pool_name: str, - import_package_info_request: Union[_models.ImportPackageInfoRequest, IO[bytes]], + import_package_info_request: Optional[Union[_models.ImportPackageInfoRequest, IO[bytes]]] = None, **kwargs: Any ) -> Iterable["_models.AppAttachPackage"]: """Gets information from a package given the path to the package. @@ -169,8 +166,8 @@ def import_method( :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. + :param import_package_info_request: Is either a ImportPackageInfoRequest type or a IO[bytes] + type. Default value is None. :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) @@ -184,7 +181,7 @@ def import_method( 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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +194,10 @@ def import_method( if isinstance(import_package_info_request, (IOBase, bytes)): _content = import_package_info_request else: - _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + if import_package_info_request is not None: + _json = self._serialize.body(import_package_info_request, "ImportPackageInfoRequest") + else: + _json = None def prepare_request(next_link=None): if not next_link: 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 index a6b06fb591c3..91aeba23cb9f 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,39 +39,29 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, app_attach_package_name: str, subscription_id: str, **kwargs: Any +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-04-03")) + 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}", + "template_url", "/subscriptions/{subscriptionId}/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 - ), - "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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -80,56 +69,47 @@ def build_get_request( 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 +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-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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}", + "/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 ), - "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 filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +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-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,16 +140,16 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +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-04-03")) + 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") @@ -203,71 +183,97 @@ def build_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any +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-04-03")) + 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", + "/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 filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request( - subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any +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-04-03")) + 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" + "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 filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class AppAttachPackageOperations: @@ -289,6 +295,170 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_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, host + pool, and resource group. 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 = { + 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) + + @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 and + host pool. 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 = { + 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 get(self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any) -> _models.AppAttachPackage: """Get an app attach package. @@ -302,7 +472,7 @@ def get(self, resource_group_name: str, app_attach_package_name: str, **kwargs: :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +592,7 @@ def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,60 +647,6 @@ def create_or_update( return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, app_attach_package_name: str, **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. Required. - :type app_attach_package_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_delete_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, 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, @@ -548,8 +664,7 @@ def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Default value - is None. + :param app_attach_package_patch: The resource properties to be updated. 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". @@ -576,8 +691,7 @@ def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Default value - is None. + :param app_attach_package_patch: The resource properties to be updated. 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". @@ -602,7 +716,7 @@ def update( :type resource_group_name: str :param app_attach_package_name: The name of the App Attach package. Required. :type app_attach_package_name: str - :param app_attach_package_patch: Object containing App Attach Package definition. Is either a + :param app_attach_package_patch: The resource properties to be updated. 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] @@ -610,7 +724,7 @@ def update( :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,28 +783,23 @@ def update( 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. + 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 filter: OData filter expression. Valid properties for filtering are package name and - host pool. 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] + :param app_attach_package_name: The name of the App Attach package. Required. + :type app_attach_package_name: str + :param force: Allows force delete. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppAttachPackageList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,136 +807,34 @@ def list_by_resource_group( } 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, host - pool, and resource group. 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) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 870748fdddd9..4811cc7e46df 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,39 +39,76 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, application_group_name: str, subscription_id: str, **kwargs: Any +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-04-03")) + 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/applicationGroups" + ) # 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) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups", ) # 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 ), - "applicationGroupName": _SERIALIZER.url( - "application_group_name", - application_group_name, - "str", - max_length=64, - 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") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -80,14 +116,13 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, application_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,20 +151,19 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_request( resource_group_name: str, application_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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 @@ -158,9 +192,11 @@ def build_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( @@ -169,7 +205,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", "2024-04-03")) + 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") @@ -206,101 +242,243 @@ def build_update_request( 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, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, application_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/applicationGroups", + "/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"), "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, + 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_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 {}) +class ApplicationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - accept = _headers.pop("Accept", "application/json") + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`application_groups` attribute. + """ - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } + models = _models - _url: str = _url.format(**path_format_arguments) # type: ignore + 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") - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + @distributed_trace + def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ApplicationGroup"]: + """List applicationGroups in subscription. - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. Default value is None. + :type filter: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + 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: MutableMapping = { + 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("ApplicationGroupList", 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_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ApplicationGroup"]: + """List applicationGroups. + + :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 + applicationGroupType. Default value is None. + :type filter: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.ApplicationGroupList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ApplicationGroupList", 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) -class ApplicationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - Instead, you should access the following operations through - :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s - :attr:`application_groups` attribute. - """ + 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) - models = _models + return pipeline_response - 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") + return ItemPaged(get_next, extract_data) @distributed_trace def get(self, resource_group_name: str, application_group_name: str, **kwargs: Any) -> _models.ApplicationGroup: @@ -315,7 +493,7 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +526,8 @@ def get(self, resource_group_name: str, application_group_name: str, **kwargs: A 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -433,7 +612,7 @@ def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,7 +657,8 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -487,59 +667,6 @@ def create_or_update( return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, application_group_name: str, **kwargs: Any - ) -> None: - """Remove an applicationGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_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_delete_request( - resource_group_name=resource_group_name, - application_group_name=application_group_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, 204]: - 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 - @overload def update( self, @@ -557,8 +684,7 @@ def update( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. Default value is - None. + :param application_group: The AppGroup properties to be updated. Default value is None. :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -585,8 +711,7 @@ def update( :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. Default value is - None. + :param application_group: The AppGroup properties to be updated. Default value is None. :type application_group: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -611,7 +736,7 @@ def update( :type resource_group_name: str :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 + :param application_group: The AppGroup properties to be updated. Is either a ApplicationGroupPatch type or a IO[bytes] type. Default value is None. :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch or IO[bytes] @@ -619,7 +744,7 @@ def update( :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +792,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationGroup", pipeline_response.http_response) @@ -677,40 +803,21 @@ def update( return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - filter: Optional[str] = None, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ApplicationGroup"]: - """List applicationGroups. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_group_name: str, **kwargs: Any + ) -> None: + """Remove an applicationGroup. :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 - applicationGroupType. Default value is None. - :type filter: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ApplicationGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationGroupList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,137 +825,33 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ApplicationGroupList", 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) - - @distributed_trace - def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ApplicationGroup"]: - """List applicationGroups in subscription. - - :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. Default value is None. - :type filter: str - :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: - """ _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.ApplicationGroupList] = 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("ApplicationGroupList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 0d9e753eab88..8836cf6117f3 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,19 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, application_group_name: str, application_name: str, subscription_id: str, **kwargs: Any +def build_list_request( + resource_group_name: str, + application_group_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/applicationGroups/{applicationGroupName}/applications/{applicationName}", + "/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"), @@ -67,15 +73,18 @@ def build_get_request( min_length=3, 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@.\-_ ]*$" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -83,14 +92,13 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, application_group_name: str, application_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-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,20 +130,19 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_request( resource_group_name: str, application_group_name: str, application_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-04-03")) + 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 @@ -167,9 +174,11 @@ def build_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( @@ -178,7 +187,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", "2024-04-03")) + 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") @@ -218,26 +227,19 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, - application_group_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, application_group_name: str, application_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-04-03")) + 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/applicationGroups/{applicationGroupName}/applications", + "/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"), @@ -252,23 +254,20 @@ def build_list_request( min_length=3, 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@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ApplicationsOperations: @@ -290,6 +289,105 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + application_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.Application"]: + """List applications. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.ApplicationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + application_group_name=application_group_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ApplicationList", 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 get( self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any @@ -308,7 +406,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +440,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -439,7 +538,7 @@ def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +584,8 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -494,63 +594,6 @@ def create_or_update( return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any - ) -> None: - """Remove an application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_name: str - :param application_name: The name of the application within the specified application group. - Required. - :type application_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload def update( self, @@ -572,7 +615,7 @@ def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Default value is None. + :param application: The resource properties to be updated. Default value is None. :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -603,7 +646,7 @@ def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Default value is None. + :param application: The resource properties to be updated. Default value is None. :type application: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -632,14 +675,14 @@ def update( :param application_name: The name of the application within the specified application group. Required. :type application_name: str - :param application: Object containing Application definitions. Is either a ApplicationPatch - type or a IO[bytes] type. Default value is None. + :param application: The resource properties to be updated. Is either a ApplicationPatch 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -688,7 +731,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Application", pipeline_response.http_response) @@ -698,39 +742,24 @@ def update( return deserialized # type: ignore @distributed_trace - def list( - self, - resource_group_name: str, - application_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Application"]: - """List applications. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, application_group_name: str, application_name: str, **kwargs: Any + ) -> None: + """Remove an application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param application_group_name: The name of the application group. Required. :type application_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either Application or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Application] + :param application_name: The name of the application within the specified application group. + Required. + :type application_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -738,59 +767,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - application_group_name=application_group_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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..1ceb9a3c0f4a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py @@ -0,0 +1,293 @@ +# 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, 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 +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=64, 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 + 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 = { + 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 actions on a session host update. + + :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: The content of the action request. 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 actions on a session host update. + + :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: The content of the action request. 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 actions on a session host update. + + :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: The content of the action request. 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 7504de7951ce..a4576ecf636e 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,19 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, application_group_name: str, desktop_name: str, subscription_id: str, **kwargs: Any +def build_list_request( + resource_group_name: str, + application_group_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/applicationGroups/{applicationGroupName}/desktops/{desktopName}", + "/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"), @@ -67,15 +73,18 @@ def build_get_request( min_length=3, 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@.\-_ ]*$" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -83,14 +92,13 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_get_request( resource_group_name: str, application_group_name: str, desktop_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-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,33 +130,25 @@ def build_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, - application_group_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_update_request( + resource_group_name: str, application_group_name: str, desktop_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-04-03")) + 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/applicationGroups/{applicationGroupName}/desktops", + "/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"), @@ -163,23 +163,22 @@ def build_list_request( min_length=3, 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@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) class DesktopsOperations: @@ -201,6 +200,105 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + application_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.Desktop"]: + """List desktops. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param application_group_name: The name of the application group. Required. + :type application_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.DesktopList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + application_group_name=application_group_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("DesktopList", 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 get( self, resource_group_name: str, application_group_name: str, desktop_name: str, **kwargs: Any @@ -218,7 +316,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +350,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Desktop", pipeline_response.http_response) @@ -281,7 +380,7 @@ 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. Default value is None. + :param desktop: The resource properties to be updated. Default value is None. :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -311,7 +410,7 @@ 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. Default value is None. + :param desktop: The resource properties to be updated. Default value is None. :type desktop: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -339,14 +438,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 + :param desktop: The resource properties to be updated. 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +494,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Desktop", pipeline_response.http_response) @@ -403,101 +503,3 @@ def update( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - application_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Desktop"]: - """List desktops. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param application_group_name: The name of the application group. Required. - :type application_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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: - """ - _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.DesktopList] = 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_request( - resource_group_name=resource_group_name, - application_group_name=application_group_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("DesktopList", 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/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py index fbd4a0b1da44..b5c4a6f0111d 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,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +32,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,34 +40,38 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +def build_list_request( + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools" + ) 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, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -75,51 +79,57 @@ def build_get_request( 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 +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools", ) # 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, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, host_pool_name: str, subscription_id: str, *, force: Optional[bool] = None, **kwargs: Any +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-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,22 +151,20 @@ def build_delete_request( # 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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +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-04-03")) + 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") @@ -185,105 +193,97 @@ def build_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +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-04-03")) + 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", + "/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"), "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, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, host_pool_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-04-03")) + 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/hostPools" - ) + "template_url", + "/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"), + "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, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _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 force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_retrieve_registration_token_request( # pylint: disable=name-too-long +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-04-03")) + 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}/retrieveRegistrationToken", + "/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"), @@ -306,19 +306,19 @@ def build_retrieve_registration_token_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_registration_tokens_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", "2024-04-03")) + 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", + "/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"), @@ -360,6 +360,191 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.HostPool"]: + """List hostPools in subscription. + + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.HostPoolList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("HostPoolList", 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_resource_group( + self, + resource_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.HostPool"]: + """List hostPools. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.HostPoolList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("HostPoolList", 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 get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.HostPool: """Get a host pool. @@ -373,7 +558,7 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +591,8 @@ def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _ 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HostPool", pipeline_response.http_response) @@ -475,94 +661,23 @@ def create_or_update( 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. - - :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: 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: 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.HostPool] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(host_pool, (IOBase, bytes)): - _content = host_pool - else: - _json = self._serialize.body(host_pool, "HostPool") - - _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("HostPool", 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, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any - ) -> None: - """Remove a host pool. + **kwargs: Any + ) -> _models.HostPool: + """Create or update a host pool. :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 force: Force flag to delete sessionHost. Default value is None. - :type force: bool - :return: None or the result of cls(response) - :rtype: None + :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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,18 +685,29 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HostPool] = kwargs.pop("cls", None) - _request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(host_pool, (IOBase, bytes)): + _content = host_pool + else: + _json = self._serialize.body(host_pool, "HostPool") + + _request = build_create_or_update_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, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -594,12 +720,17 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HostPool", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def update( @@ -618,7 +749,7 @@ def 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. Default value is None. + :param host_pool: The properties to be updated. Default value is None. :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -645,7 +776,7 @@ def 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. Default value is None. + :param host_pool: The properties to be updated. Default value is None. :type host_pool: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -670,14 +801,14 @@ def 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 HostPoolPatch type or a - IO[bytes] type. Default value is None. + :param host_pool: The properties to be updated. Is either a HostPoolPatch type or a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -725,7 +856,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("HostPool", pipeline_response.http_response) @@ -735,36 +867,23 @@ def update( return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.HostPool"]: - """List hostPools. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, force: Optional[bool] = None, **kwargs: Any + ) -> None: + """Remove a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either HostPool or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPool] + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param force: Force flag to delete sessionHost. Default value is None. + :type force: bool + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HostPoolList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,167 +891,54 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("HostPoolList", 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) - - @distributed_trace - def list( - self, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.HostPool"]: - """List hostPools in subscription. - - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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: - """ _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.HostPoolList] = 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_request( - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("HostPoolList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def retrieve_registration_token( + def list_registration_tokens( self, resource_group_name: str, host_pool_name: str, **kwargs: Any - ) -> _models.RegistrationInfo: - """Registration token of the host pool. + ) -> _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: RegistrationInfo or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :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]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,9 +950,9 @@ def retrieve_registration_token( _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.RegistrationInfo] = kwargs.pop("cls", None) + cls: ClsType[_models.RegistrationTokenList] = kwargs.pop("cls", None) - _request = build_retrieve_registration_token_request( + _request = build_list_registration_tokens_request( resource_group_name=resource_group_name, host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, @@ -965,9 +971,10 @@ def retrieve_registration_token( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) + deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -975,21 +982,21 @@ def retrieve_registration_token( return deserialized # type: ignore @distributed_trace - def list_registration_tokens( + def retrieve_registration_token( self, resource_group_name: str, host_pool_name: str, **kwargs: Any - ) -> _models.RegistrationTokenList: - """Operation to list the RegistrationTokens associated with the HostPool. + ) -> _models.RegistrationInfo: + """Registration token of the host pool. :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 + :return: RegistrationInfo or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1001,9 +1008,9 @@ def list_registration_tokens( _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) + cls: ClsType[_models.RegistrationInfo] = kwargs.pop("cls", None) - _request = build_list_registration_tokens_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, @@ -1022,9 +1029,10 @@ def list_registration_tokens( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegistrationTokenList", pipeline_response.http_response) + deserialized = self._deserialize("RegistrationInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, 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..1d113acd16ca --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,229 @@ +# 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, 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 +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=64, 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 + 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( + 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: The resource properties to be updated. 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( + 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: The resource properties to be updated. 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: The resource properties to be updated. 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 = { + 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 [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 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 a602ef61d945..173e03316fd3 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +45,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", "2024-04-03")) + 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") @@ -102,19 +101,20 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: _models.MSIXImageURI, + msix_image_uri: Optional[_models.MSIXImageURI] = None, *, content_type: str = "application/json", **kwargs: Any ) -> Iterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Required. + :param msix_image_uri: Default value is None. :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -129,19 +129,20 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: IO[bytes], + msix_image_uri: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> Iterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Required. + :param msix_image_uri: Default value is None. :type msix_image_uri: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -156,18 +157,19 @@ def expand( self, resource_group_name: str, host_pool_name: str, - msix_image_uri: Union[_models.MSIXImageURI, IO[bytes]], + msix_image_uri: Optional[Union[_models.MSIXImageURI, IO[bytes]]] = None, **kwargs: Any ) -> Iterable["_models.ExpandMsixImage"]: """Expands and Lists MSIX packages in an Image, given the Image Path. + This action uses incorrect Msix casing intentionally to match the previous APIs. :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 msix_image_uri: Object containing URI to MSIX Image. Is either a MSIXImageURI type or a - IO[bytes] type. Required. + :param msix_image_uri: Is either a MSIXImageURI type or a IO[bytes] type. Default value is + None. :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] @@ -180,7 +182,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +195,10 @@ def expand( if isinstance(msix_image_uri, (IOBase, bytes)): _content = msix_image_uri else: - _json = self._serialize.body(msix_image_uri, "MSIXImageURI") + if msix_image_uri is not None: + _json = self._serialize.body(msix_image_uri, "MSIXImageURI") + else: + _json = None def prepare_request(next_link=None): if not next_link: @@ -246,7 +251,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 645fa353dc5c..72807e61f1c6 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,19 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, host_pool_name: str, msix_package_full_name: str, subscription_id: str, **kwargs: Any +def build_list_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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}/msixPackages/{msixPackageFullName}", + "/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"), @@ -62,20 +68,18 @@ def build_get_request( "hostPoolName": _SERIALIZER.url( "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "msixPackageFullName": _SERIALIZER.url( - "msix_package_full_name", - msix_package_full_name, - "str", - max_length=100, - 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -83,20 +87,19 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, host_pool_name: str, msix_package_full_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-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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}/msixPackages/{msixPackageFullName}", + "/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"), @@ -122,26 +125,25 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_request( resource_group_name: str, host_pool_name: str, msix_package_full_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-04-03")) + 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}/msixPackages/{msixPackageFullName}", + "/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"), @@ -167,9 +169,11 @@ def build_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( @@ -178,14 +182,14 @@ 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", "2024-04-03")) + 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}/msixPackages/{msixPackageFullName}", + "/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"), @@ -218,26 +222,19 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, - host_pool_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, host_pool_name: str, msix_package_full_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-04-03")) + 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}/msixPackages", + "/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"), @@ -247,23 +244,25 @@ def build_list_request( "hostPoolName": _SERIALIZER.url( "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), + "msixPackageFullName": _SERIALIZER.url( + "msix_package_full_name", + msix_package_full_name, + "str", + max_length=100, + 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class MSIXPackagesOperations: @@ -285,6 +284,105 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.MSIXPackage"]: + """List MSIX packages in 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 page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.MSIXPackageList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("MSIXPackageList", 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 get( self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any @@ -303,7 +401,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +435,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -434,7 +533,7 @@ def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +579,8 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -489,70 +589,13 @@ def create_or_update( return deserialized # type: ignore - @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 - ) -> None: - """Remove an MSIX 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 msix_package_full_name: The version specific package full name of the MSIX package - within specified hostpool. Required. - :type msix_package_full_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload def update( self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[_models.MSIXPackagePatch] = None, + msix_package: _models.MSIXPackagePatch, *, content_type: str = "application/json", **kwargs: Any @@ -567,7 +610,7 @@ def update( :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 - :param msix_package: Object containing MSIX Package definitions. Default value is None. + :param msix_package: The resource properties to be updated. Required. :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -583,7 +626,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[IO[bytes]] = None, + msix_package: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -598,7 +641,7 @@ def update( :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 - :param msix_package: Object containing MSIX Package definitions. Default value is None. + :param msix_package: The resource properties to be updated. Required. :type msix_package: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -614,7 +657,7 @@ def update( resource_group_name: str, host_pool_name: str, msix_package_full_name: str, - msix_package: Optional[Union[_models.MSIXPackagePatch, IO[bytes]]] = None, + msix_package: Union[_models.MSIXPackagePatch, IO[bytes]], **kwargs: Any ) -> _models.MSIXPackage: """Update an MSIX Package. @@ -627,14 +670,14 @@ def update( :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 - :param msix_package: Object containing MSIX Package definitions. Is either a MSIXPackagePatch - type or a IO[bytes] type. Default value is None. + :param msix_package: The resource properties to be updated. Is either a MSIXPackagePatch type + or a IO[bytes] type. Required. :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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,10 +698,7 @@ def update( if isinstance(msix_package, (IOBase, bytes)): _content = msix_package else: - if msix_package is not None: - _json = self._serialize.body(msix_package, "MSIXPackagePatch") - else: - _json = None + _json = self._serialize.body(msix_package, "MSIXPackagePatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -683,7 +723,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("MSIXPackage", pipeline_response.http_response) @@ -693,39 +734,24 @@ def update( return deserialized # type: ignore @distributed_trace - def list( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.MSIXPackage"]: - """List MSIX packages in hostpool. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, msix_package_full_name: str, **kwargs: Any + ) -> None: + """Remove an MSIX 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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either MSIXPackage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackage] + :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 + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MSIXPackageList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,59 +759,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - host_pool_name=host_pool_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = self._deserialize("MSIXPackageList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 066c8cf26276..e48c7fe5477a 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,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", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +78,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: - """List all of the available operations the Desktop Virtualization resource provider supports. + """List the operations for the provider. :return: An iterator like instance of either ResourceProviderOperation or the result of cls(response) @@ -91,9 +90,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: _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.ResourceProviderOperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceProviderOperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +128,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -146,7 +145,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 723ac5e2b192..ac7405541f09 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,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +32,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,27 +40,34 @@ _SERIALIZER.client_side_validation = False -def build_list_by_workspace_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any +def build_list_by_host_pool_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/workspaces/{workspaceName}/privateEndpointConnections", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -68,6 +75,12 @@ def build_list_by_workspace_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -75,9 +88,9 @@ def build_list_by_workspace_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_by_workspace_request( +def build_get_by_host_pool_request( resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -85,21 +98,21 @@ 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", "2024-04-03")) + 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/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -117,9 +130,9 @@ def build_get_by_workspace_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_by_workspace_request( +def build_update_by_host_pool_request( resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -127,21 +140,22 @@ 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", "2024-04-03")) + 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/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -154,14 +168,16 @@ def build_delete_by_workspace_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_by_workspace_request( +def build_delete_by_host_pool_request( resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -169,22 +185,21 @@ 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", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -197,41 +212,32 @@ def build_update_by_workspace_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", 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, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_list_by_workspace_request( + resource_group_name: str, workspace_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-04-03")) + 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}/privateEndpointConnections", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -239,12 +245,6 @@ def build_list_by_host_pool_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -252,9 +252,9 @@ def build_list_by_host_pool_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_by_host_pool_request( +def build_get_by_workspace_request( resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -262,21 +262,21 @@ 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", "2024-04-03")) + 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}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -294,9 +294,9 @@ def build_get_by_host_pool_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_by_host_pool_request( +def build_update_by_workspace_request( resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -304,21 +304,22 @@ 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", "2024-04-03")) + 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}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -331,14 +332,16 @@ def build_delete_by_host_pool_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_by_host_pool_request( +def build_delete_by_workspace_request( resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any @@ -346,22 +349,21 @@ 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", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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}/privateEndpointConnections/{privateEndpointConnectionName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -374,11 +376,9 @@ def build_update_by_host_pool_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class PrivateEndpointConnectionsOperations: @@ -401,16 +401,28 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_workspace( - self, resource_group_name: str, workspace_name: str, **kwargs: Any + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> Iterable["_models.PrivateEndpointConnectionWithSystemData"]: - """List private endpoint connections. + """Get a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -423,7 +435,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,10 +446,13 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_workspace_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, api_version=api_version, headers=_headers, params=_params, @@ -479,31 +494,31 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 get_by_workspace( - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + def get_by_host_pool( + self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Get a private endpoint connection. + """Get a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,9 +532,9 @@ 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_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, @@ -537,7 +552,8 @@ def get_by_workspace( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -546,86 +562,29 @@ def get_by_workspace( return deserialized # type: ignore - @distributed_trace - def delete_by_workspace( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Remove a connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload - def update_by_workspace( + def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, - connection: _models.PrivateEndpointConnection, + connection: _models.PrivateEndpointConnectionWithSystemData, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection + :param connection: Resource create parameters. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -635,27 +594,26 @@ def update_by_workspace( """ @overload - def update_by_workspace( + def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. + :param connection: Resource create parameters. Required. :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -666,33 +624,32 @@ def update_by_workspace( """ @distributed_trace - def update_by_workspace( + def update_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO[bytes]], + connection: Union[_models.PrivateEndpointConnectionWithSystemData, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or - IO[bytes] + :param connection: Resource create parameters. Is either a + PrivateEndpointConnectionWithSystemData type or a IO[bytes] type. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData or IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -713,11 +670,11 @@ def update_by_workspace( if isinstance(connection, (IOBase, bytes)): _content = connection else: - _json = self._serialize.body(connection, "PrivateEndpointConnection") + _json = self._serialize.body(connection, "PrivateEndpointConnectionWithSystemData") - _request = build_update_by_workspace_request( + _request = build_update_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_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, @@ -736,9 +693,10 @@ def update_by_workspace( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -748,28 +706,73 @@ def update_by_workspace( return deserialized # type: ignore @distributed_trace - def list_by_host_pool( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionWithSystemData"]: - """List private endpoint connections associated with hostpool. + def delete_by_host_pool( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnectionWithSystemData. :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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _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_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, + 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 + + @distributed_trace + def list_by_workspace( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionWithSystemData"]: + """Get a PrivateEndpointConnectionWithSystemData. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str :return: An iterator like instance of either PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: @@ -782,7 +785,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,13 +796,10 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, api_version=api_version, headers=_headers, params=_params, @@ -841,31 +841,31 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 get_by_host_pool( - self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any + def get_by_workspace( + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Get a private endpoint connection. + """Get a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,9 +879,9 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -899,7 +899,8 @@ def get_by_host_pool( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -908,86 +909,29 @@ def get_by_host_pool( return deserialized # type: ignore - @distributed_trace - def delete_by_host_pool( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, host_pool_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Remove a connection. - - :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload - def update_by_host_pool( + def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, - connection: _models.PrivateEndpointConnection, + connection: _models.PrivateEndpointConnectionWithSystemData, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection + :param connection: Resource create parameters. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -997,27 +941,26 @@ def update_by_host_pool( """ @overload - def update_by_host_pool( + def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Required. + :param connection: Resource create parameters. Required. :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -1028,33 +971,32 @@ def update_by_host_pool( """ @distributed_trace - def update_by_host_pool( + def update_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, private_endpoint_connection_name: str, - connection: Union[_models.PrivateEndpointConnection, IO[bytes]], + connection: Union[_models.PrivateEndpointConnectionWithSystemData, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnectionWithSystemData: - """Approve or reject a private endpoint connection. + """Create a PrivateEndpointConnectionWithSystemData. :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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. :type private_endpoint_connection_name: str - :param connection: Object containing the updated connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection or - IO[bytes] + :param connection: Resource create parameters. Is either a + PrivateEndpointConnectionWithSystemData type or a IO[bytes] type. Required. + :type connection: + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData or IO[bytes] :return: PrivateEndpointConnectionWithSystemData or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1075,11 +1017,11 @@ def update_by_host_pool( if isinstance(connection, (IOBase, bytes)): _content = connection else: - _json = self._serialize.body(connection, "PrivateEndpointConnection") + _json = self._serialize.body(connection, "PrivateEndpointConnectionWithSystemData") - _request = build_update_by_host_pool_request( + _request = build_update_by_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -1098,9 +1040,10 @@ def update_by_host_pool( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnectionWithSystemData", pipeline_response.http_response) @@ -1108,3 +1051,60 @@ def update_by_host_pool( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @distributed_trace + def delete_by_workspace( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnectionWithSystemData. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param private_endpoint_connection_name: The name parameter for private endpoint. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _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_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, + 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 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 29d187f3a69e..fcc916b35199 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,9 +38,9 @@ _SERIALIZER.client_side_validation = False -def build_list_by_workspace_request( +def build_list_by_host_pool_request( resource_group_name: str, - workspace_name: str, + host_pool_name: str, subscription_id: str, *, page_size: Optional[int] = None, @@ -52,21 +51,21 @@ 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", "2024-04-03")) + 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/workspaces/{workspaceName}/privateLinkResources", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -87,9 +86,9 @@ def build_list_by_workspace_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_host_pool_request( +def build_list_by_workspace_request( resource_group_name: str, - host_pool_name: str, + workspace_name: str, subscription_id: str, *, page_size: Optional[int] = None, @@ -100,21 +99,21 @@ 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", "2024-04-03")) + 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}/privateLinkResources", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -155,22 +154,22 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_workspace( + def list_by_host_pool( self, resource_group_name: str, - workspace_name: str, + host_pool_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, **kwargs: Any ) -> Iterable["_models.PrivateLinkResource"]: - """List the private link resources available for this workspace. + """List the private link resources available for this hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -188,7 +187,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,9 +198,9 @@ def list_by_workspace( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_workspace_request( + _request = build_list_by_host_pool_request( resource_group_name=resource_group_name, - workspace_name=workspace_name, + host_pool_name=host_pool_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, @@ -247,29 +246,30 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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_host_pool( + def list_by_workspace( self, resource_group_name: str, - host_pool_name: str, + workspace_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, **kwargs: Any ) -> Iterable["_models.PrivateLinkResource"]: - """List the private link resources available for this hostpool. + """List the private link resources available for this workspace. :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 workspace_name: The name of the workspace. Required. + :type workspace_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -287,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,9 +298,9 @@ 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_workspace_request( resource_group_name=resource_group_name, - host_pool_name=host_pool_name, + workspace_name=workspace_name, subscription_id=self._config.subscription_id, page_size=page_size, is_descending=is_descending, @@ -346,7 +346,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 a28ff48dc5a4..f5493ce9d34c 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,23 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( +def build_list_request( resource_group_name: str, scaling_plan_name: str, - scaling_plan_schedule_name: str, subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}", + "/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"), @@ -66,20 +68,18 @@ def build_get_request( "scalingPlanName": _SERIALIZER.url( "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", - scaling_plan_schedule_name, - "str", - max_length=64, - 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -87,7 +87,7 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request( +def build_get_request( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, @@ -97,8 +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", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,14 +129,12 @@ def build_create_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_request( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, @@ -147,7 +144,8 @@ 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", "2024-04-03")) + 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 @@ -179,9 +177,11 @@ def build_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( @@ -194,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", "2024-04-03")) + 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") @@ -234,26 +234,23 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( +def build_delete_request( resource_group_name: str, scaling_plan_name: str, + scaling_plan_schedule_name: str, subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}/personalSchedules", + "/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"), @@ -263,23 +260,25 @@ def build_list_request( "scalingPlanName": _SERIALIZER.url( "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), + "scalingPlanScheduleName": _SERIALIZER.url( + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ScalingPlanPersonalSchedulesOperations: @@ -301,6 +300,107 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + scaling_plan_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ScalingPlanPersonalSchedule"]: + """List ScalingPlanPersonalSchedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] + :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.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanPersonalScheduleList", 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 get( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -318,7 +418,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +452,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -450,7 +551,7 @@ def create( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +597,8 @@ def create( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -505,69 +607,13 @@ def create( return deserialized # type: ignore - @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 - ) -> None: - """Remove a ScalingPlanPersonalSchedule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. - :type scaling_plan_schedule_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload def update( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[_models.ScalingPlanPersonalSchedulePatch] = None, + scaling_plan_personal_schedule: Optional[_models.ScalingPlanPersonalSchedulePatch] = None, *, content_type: str = "application/json", **kwargs: Any @@ -581,9 +627,9 @@ def update( :type scaling_plan_name: str :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. - Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_personal_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_personal_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedulePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -599,7 +645,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO[bytes]] = None, + scaling_plan_personal_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -613,9 +659,9 @@ def update( :type scaling_plan_name: str :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. - Default value is None. - :type scaling_plan_schedule: IO[bytes] + :param scaling_plan_personal_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_personal_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 @@ -630,7 +676,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, + scaling_plan_personal_schedule: Optional[Union[_models.ScalingPlanPersonalSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPersonalSchedule: """Update a ScalingPlanPersonalSchedule. @@ -642,15 +688,15 @@ def update( :type scaling_plan_name: str :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[bytes] type. Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_personal_schedule: The resource properties to be updated. Is either a + ScalingPlanPersonalSchedulePatch type or a IO[bytes] type. Default value is None. + :type scaling_plan_personal_schedule: ~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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,11 +714,11 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(scaling_plan_schedule, (IOBase, bytes)): - _content = scaling_plan_schedule + if isinstance(scaling_plan_personal_schedule, (IOBase, bytes)): + _content = scaling_plan_personal_schedule else: - if scaling_plan_schedule is not None: - _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPersonalSchedulePatch") + if scaling_plan_personal_schedule is not None: + _json = self._serialize.body(scaling_plan_personal_schedule, "ScalingPlanPersonalSchedulePatch") else: _json = None @@ -699,7 +745,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPersonalSchedule", pipeline_response.http_response) @@ -709,41 +756,23 @@ def update( return deserialized # type: ignore @distributed_trace - def list( - self, - resource_group_name: str, - scaling_plan_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ScalingPlanPersonalSchedule"]: - """List ScalingPlanPersonalSchedules. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any + ) -> None: + """Remove a ScalingPlanPersonalSchedule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ScalingPlanPersonalSchedule or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPersonalSchedule] + :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. + :type scaling_plan_schedule_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanPersonalScheduleList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -751,59 +780,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanPersonalScheduleList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 272f08869c78..058c74425004 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,23 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( +def build_list_request( resource_group_name: str, scaling_plan_name: str, - scaling_plan_schedule_name: str, subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}", + "/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"), @@ -66,20 +68,18 @@ def build_get_request( "scalingPlanName": _SERIALIZER.url( "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), - "scalingPlanScheduleName": _SERIALIZER.url( - "scaling_plan_schedule_name", - scaling_plan_schedule_name, - "str", - max_length=64, - 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -87,7 +87,7 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request( +def build_get_request( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, @@ -97,8 +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", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,14 +129,12 @@ def build_create_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_request( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, @@ -147,7 +144,8 @@ 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", "2024-04-03")) + 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 @@ -179,9 +177,11 @@ def build_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( @@ -194,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", "2024-04-03")) + 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") @@ -234,26 +234,23 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( +def build_delete_request( resource_group_name: str, scaling_plan_name: str, + scaling_plan_schedule_name: str, subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}/pooledSchedules", + "/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"), @@ -263,23 +260,25 @@ def build_list_request( "scalingPlanName": _SERIALIZER.url( "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), + "scalingPlanScheduleName": _SERIALIZER.url( + "scaling_plan_schedule_name", + scaling_plan_schedule_name, + "str", + max_length=64, + 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ScalingPlanPooledSchedulesOperations: @@ -301,6 +300,107 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + scaling_plan_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ScalingPlanPooledSchedule"]: + """List ScalingPlanPooledSchedules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] + :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.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + subscription_id=self._config.subscription_id, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanPooledScheduleList", 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 get( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any @@ -318,7 +418,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +452,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -449,7 +550,7 @@ def create( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -495,7 +596,8 @@ def create( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -504,69 +606,13 @@ def create( return deserialized # type: ignore - @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 - ) -> None: - """Remove a ScalingPlanPooledSchedule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. - :type scaling_plan_schedule_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_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, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @overload def update( self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[_models.ScalingPlanPooledSchedulePatch] = None, + scaling_plan_pooled_schedule: Optional[_models.ScalingPlanPooledSchedulePatch] = None, *, content_type: str = "application/json", **kwargs: Any @@ -580,9 +626,9 @@ def update( :type scaling_plan_name: str :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. Default - value is None. - :type scaling_plan_schedule: + :param scaling_plan_pooled_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_pooled_schedule: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedulePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -598,7 +644,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[IO[bytes]] = None, + scaling_plan_pooled_schedule: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -612,9 +658,9 @@ def update( :type scaling_plan_name: str :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. Default - value is None. - :type scaling_plan_schedule: IO[bytes] + :param scaling_plan_pooled_schedule: The resource properties to be updated. Default value is + None. + :type scaling_plan_pooled_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 @@ -629,7 +675,7 @@ def update( resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, - scaling_plan_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, + scaling_plan_pooled_schedule: Optional[Union[_models.ScalingPlanPooledSchedulePatch, IO[bytes]]] = None, **kwargs: Any ) -> _models.ScalingPlanPooledSchedule: """Update a ScalingPlanPooledSchedule. @@ -641,15 +687,15 @@ def update( :type scaling_plan_name: str :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[bytes] type. Default value is None. - :type scaling_plan_schedule: + :param scaling_plan_pooled_schedule: The resource properties to be updated. Is either a + ScalingPlanPooledSchedulePatch type or a IO[bytes] type. Default value is None. + :type scaling_plan_pooled_schedule: ~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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,11 +713,11 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(scaling_plan_schedule, (IOBase, bytes)): - _content = scaling_plan_schedule + if isinstance(scaling_plan_pooled_schedule, (IOBase, bytes)): + _content = scaling_plan_pooled_schedule else: - if scaling_plan_schedule is not None: - _json = self._serialize.body(scaling_plan_schedule, "ScalingPlanPooledSchedulePatch") + if scaling_plan_pooled_schedule is not None: + _json = self._serialize.body(scaling_plan_pooled_schedule, "ScalingPlanPooledSchedulePatch") else: _json = None @@ -698,7 +744,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlanPooledSchedule", pipeline_response.http_response) @@ -708,41 +755,23 @@ def update( return deserialized # type: ignore @distributed_trace - def list( - self, - resource_group_name: str, - scaling_plan_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ScalingPlanPooledSchedule"]: - """List ScalingPlanPooledSchedules. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, scaling_plan_name: str, scaling_plan_schedule_name: str, **kwargs: Any + ) -> None: + """Remove a ScalingPlanPooledSchedule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. Required. :type scaling_plan_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ScalingPlanPooledSchedule or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanPooledSchedule] + :param scaling_plan_schedule_name: The name of the ScalingPlanSchedule. Required. + :type scaling_plan_schedule_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanPooledScheduleList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,59 +779,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = self._deserialize("ScalingPlanPooledScheduleList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 96cb4dae6d9d..5dfc2a4cf010 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,34 +39,38 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, scaling_plan_name: str, subscription_id: str, **kwargs: Any +def build_list_by_subscription_request( + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}", + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans" ) # 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 - ), - "scalingPlanName": _SERIALIZER.url( - "scaling_plan_name", scaling_plan_name, "str", max_length=64, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -75,28 +78,34 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request( - resource_group_name: str, scaling_plan_name: str, subscription_id: str, **kwargs: Any +def build_list_by_host_pool_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -104,58 +113,70 @@ def build_create_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, scaling_plan_name: str, subscription_id: str, **kwargs: Any +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/scalingPlans/{scalingPlanName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans", ) # 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 ), - "scalingPlanName": _SERIALIZER.url( - "scaling_plan_name", scaling_plan_name, "str", max_length=64, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_get_request( resource_group_name: str, scaling_plan_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-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,124 +200,108 @@ def build_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_create_request( + resource_group_name: str, scaling_plan_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-04-03")) + 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/scalingPlans", + "/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"), "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, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request( - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_update_request( + resource_group_name: str, scaling_plan_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-04-03")) + 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}/providers/Microsoft.DesktopVirtualization/scalingPlans" + "template_url", + "/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"), + "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, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + 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, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, scaling_plan_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-04-03")) + 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}/scalingPlans", + "/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"), "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + "scalingPlanName": _SERIALIZER.url( + "scaling_plan_name", scaling_plan_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" ), } @@ -304,17 +309,11 @@ def build_list_by_host_pool_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ScalingPlansOperations: @@ -337,19 +336,32 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) -> _models.ScalingPlan: - """Get a scaling plan. + def list_by_subscription( + self, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ScalingPlan"]: + """List scaling plans in subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_name: str - :return: ScalingPlan or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: """ - error_map: MutableMapping[int, Type[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.ScalingPlanList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,34 +369,306 @@ def get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) - } 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.ScalingPlan] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _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, + 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 - ) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = self._deserialize("ScalingPlanList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ScalingPlan"]: + """List scaling plan associated with 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 page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.ScalingPlanList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanList", 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_resource_group( + self, + resource_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ScalingPlan"]: + """List scaling plans. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.ScalingPlanList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("ScalingPlanList", 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 get(self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any) -> _models.ScalingPlan: + """Get a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :return: ScalingPlan or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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.ScalingPlan] = kwargs.pop("cls", None) + + _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, + 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("ScalingPlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -467,7 +751,7 @@ def create( :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,7 +796,8 @@ def create( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) @@ -521,59 +806,6 @@ def create( return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any - ) -> None: - """Remove a scaling plan. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scaling_plan_name: The name of the scaling plan. Required. - :type scaling_plan_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_delete_request( - resource_group_name=resource_group_name, - scaling_plan_name=scaling_plan_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, 204]: - 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 - @overload def update( self, @@ -591,7 +823,7 @@ def update( :type resource_group_name: str :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. + :param scaling_plan: The resource properties to be updated. Default value is None. :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -618,7 +850,7 @@ def update( :type resource_group_name: str :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. + :param scaling_plan: The resource properties to be updated. Default value is None. :type scaling_plan: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -643,14 +875,14 @@ def update( :type resource_group_name: str :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[bytes] type. Default value is None. + :param scaling_plan: The resource properties to be updated. Is either a ScalingPlanPatch 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,7 +930,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScalingPlan", pipeline_response.http_response) @@ -708,126 +941,21 @@ def update( return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ScalingPlan"]: - """List scaling plans. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, scaling_plan_name: str, **kwargs: Any + ) -> None: + """Remove a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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: - """ - _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.ScalingPlanList] = 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ScalingPlanList", 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) - - @distributed_trace - def list_by_subscription( - self, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ScalingPlan"]: - """List scaling plans in subscription. - - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either ScalingPlan or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlan] + :param scaling_plan_name: The name of the scaling plan. Required. + :type scaling_plan_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ScalingPlanList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -835,155 +963,33 @@ def list_by_subscription( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ScalingPlanList", 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) - - @distributed_trace - def list_by_host_pool( - self, - resource_group_name: str, - host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.ScalingPlan"]: - """List scaling plan associated with 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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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: - """ _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.ScalingPlanList] = 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("ScalingPlanList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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, + 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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..bf1e9111625d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py @@ -0,0 +1,768 @@ +# 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, 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 +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_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=64, 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="GET", 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=64, 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="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}/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=64, 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 + 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=64, 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 + 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) + + +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") + + @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 = { + 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) + 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 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + 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 = { + 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 = {} + if response.status_code == 201: + 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_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: Resource create parameters. 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: Resource create parameters. 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: Resource create parameters. 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): + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # 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 = { + 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.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: The resource properties to be updated. 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: The resource properties to be updated. 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: The resource properties to be updated. 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): + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # 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 + ) 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..1e0f3117bbf8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py @@ -0,0 +1,615 @@ +# 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, 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 +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_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=64, 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="GET", 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}/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=64, 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="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=64, 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 + 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=64, 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 + 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) + + +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 list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostManagement"]: + """List SessionHostManagements. + + :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 = { + 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) + 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 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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: Resource create parameters. 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: Resource create parameters. 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: Resource create parameters. 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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: The properties to be updated. 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: The properties to be updated. 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: The properties to be updated. 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 = { + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", 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_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..f58d1facf707 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py @@ -0,0 +1,149 @@ +# 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, 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 +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=64, 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="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 a SessionHostManagementUpdateStatus. + + :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 = { + 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_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py index a13604cb1569..81a38859dfad 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +39,66 @@ _SERIALIZER.client_side_validation = False +def build_list_request( + resource_group_name: str, + host_pool_name: str, + subscription_id: str, + *, + 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", "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", + ) # 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, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_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-04-03")) + 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 +130,7 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_update_request( resource_group_name: str, host_pool_name: str, session_host_name: str, @@ -90,7 +142,8 @@ 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", "2024-04-03")) + 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 @@ -119,12 +172,14 @@ def build_delete_request( _params["force"] = _SERIALIZER.query("force", force, "bool") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_delete_request( resource_group_name: str, host_pool_name: str, session_host_name: str, @@ -136,8 +191,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", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,33 +220,24 @@ def build_update_request( _params["force"] = _SERIALIZER.query("force", force, "bool") # 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) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, - host_pool_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +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-04-03")) + 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", + "/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"), @@ -202,23 +247,20 @@ def build_list_request( "hostPoolName": _SERIALIZER.url( "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) class SessionHostsOperations: @@ -241,24 +283,42 @@ def __init__(self, *args, **kwargs): 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, session_host_name: str, **kwargs: Any - ) -> _models.SessionHost: - """Get a session host. + def list( + self, + resource_group_name: str, + host_pool_name: str, + 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. :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: SessionHost or the result of cls(response) - :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: """ - error_map: MutableMapping[int, Type[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.SessionHostList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,51 +326,70 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _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, - 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 - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostList", 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) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("SessionHost", 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, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - host_pool_name: str, - session_host_name: str, - force: Optional[bool] = None, - **kwargs: Any - ) -> None: - """Remove a SessionHost. + def get( + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> _models.SessionHost: + """Get a session host. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -320,14 +399,11 @@ def delete( # pylint: disable=inconsistent-return-statements :param session_host_name: The name of the session host within the specified host pool. Required. :type session_host_name: str - :param force: Force flag to force sessionHost deletion even when userSession exists. Default - value is None. - :type force: bool - :return: None or the result of cls(response) - :rtype: None + :return: SessionHost or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,14 +415,13 @@ def delete( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[_models.SessionHost] = kwargs.pop("cls", None) - _request = build_delete_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, - force=force, api_version=api_version, headers=_headers, params=_params, @@ -360,12 +435,17 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def update( @@ -392,7 +472,7 @@ def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Default value is None. + :param session_host: The resource properties to be updated. Default value is None. :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -427,7 +507,7 @@ def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Default value is None. + :param session_host: The resource properties to be updated. Default value is None. :type session_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -460,14 +540,14 @@ def update( :param force: Force flag to update assign, unassign or reassign personal desktop. Default value is None. :type force: bool - :param session_host: Object containing SessionHost definitions. Is either a SessionHostPatch - type or a IO[bytes] type. Default value is None. + :param session_host: The resource properties to be updated. Is either a SessionHostPatch 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +597,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SessionHost", pipeline_response.http_response) @@ -527,39 +608,91 @@ def update( return deserialized # type: ignore @distributed_trace - def list( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, + session_host_name: str, + force: Optional[bool] = None, **kwargs: Any - ) -> Iterable["_models.SessionHost"]: - """List sessionHosts. + ) -> None: + """Remove 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 page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either SessionHost or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :param force: Force flag to force sessionHost deletion even when userSession exists. 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 = { + 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.SessionHostList] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + + _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, + 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 - error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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 + + @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: + """A synchronous resource action that returns no content. + + :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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,59 +700,34 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - host_pool_name=host_pool_name, - subscription_id=self._config.subscription_id, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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 + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = self._deserialize("SessionHostList", 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) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_response + if response.status_code not in [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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 5ff91168d267..62a80fcf5a5a 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # 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 +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,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", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +143,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +202,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 a551f43645f9..8849a0cb711a 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,12 +39,12 @@ _SERIALIZER.client_side_validation = False -def build_list_by_host_pool_request( +def build_list_request( resource_group_name: str, host_pool_name: str, + session_host_name: str, subscription_id: str, *, - filter: Optional[str] = None, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, @@ -54,13 +53,13 @@ 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", "2024-04-03")) + 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}/userSessions", + "/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"), @@ -70,14 +69,15 @@ def build_list_by_host_pool_request( "hostPoolName": _SERIALIZER.url( "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, 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") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if page_size is not None: _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") if is_descending is not None: @@ -102,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", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,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", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,27 +183,24 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( +def build_disconnect_request( resource_group_name: str, host_pool_name: str, session_host_name: str, + user_session_id: str, subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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}/userSessions", + "/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"), @@ -216,26 +213,21 @@ def build_list_request( "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), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_disconnect_request( +def build_send_message_request( resource_group_name: str, host_pool_name: str, session_host_name: str, @@ -246,13 +238,14 @@ 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", "2024-04-03")) + 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}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect", + "/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"), @@ -274,30 +267,34 @@ def build_disconnect_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_send_message_request( +def build_list_by_host_pool_request( resource_group_name: str, host_pool_name: str, - session_host_name: str, - user_session_id: str, subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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}/userSessions/{userSessionId}/sendMessage", + "/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"), @@ -307,23 +304,25 @@ def build_send_message_request( "hostPoolName": _SERIALIZER.url( "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, 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), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) class UserSessionsOperations: @@ -346,11 +345,11 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_host_pool( + def list( self, resource_group_name: str, host_pool_name: str, - filter: Optional[str] = None, + session_host_name: str, page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, @@ -363,9 +362,9 @@ def list_by_host_pool( :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 filter: OData filter expression. Valid properties for filtering are userprincipalname - and sessionstate. Default value is None. - :type filter: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str :param page_size: Number of items per page. Default value is None. :type page_size: int :param is_descending: Indicates whether the collection is descending. Default value is None. @@ -382,7 +381,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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,11 +392,11 @@ 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_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, - filter=filter, page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, @@ -442,7 +441,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -469,7 +469,7 @@ def get( :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +504,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("UserSession", pipeline_response.http_response) @@ -542,7 +543,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,114 +579,12 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - @distributed_trace - def list( - self, - resource_group_name: str, - host_pool_name: str, - session_host_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.UserSession"]: - """List userSessions. - - :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 - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :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: - """ - _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.UserSessionList] = 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_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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("UserSessionList", 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) - @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 @@ -707,7 +606,7 @@ def disconnect( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,13 +641,14 @@ def disconnect( # pylint: disable=inconsistent-return-statements 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) + 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 send_message( # pylint: disable=inconsistent-return-statements + def send_message( self, resource_group_name: str, host_pool_name: str, @@ -772,8 +672,7 @@ def send_message( # 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 - :param send_message: Object containing message includes title and message body. Default value - is None. + :param send_message: Default value is None. :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -784,7 +683,7 @@ def send_message( # pylint: disable=inconsistent-return-statements """ @overload - def send_message( # pylint: disable=inconsistent-return-statements + def send_message( self, resource_group_name: str, host_pool_name: str, @@ -808,8 +707,7 @@ def send_message( # 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 - :param send_message: Object containing message includes title and message body. Default value - is None. + :param send_message: Default value is None. :type send_message: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -842,14 +740,13 @@ def send_message( # 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 - :param send_message: Object containing message includes title and message body. Is either a - SendMessage type or a IO[bytes] type. Default value is None. + :param send_message: Is either a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -897,9 +794,114 @@ def send_message( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 + + @distributed_trace + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.UserSession"]: + """A synchronous resource action. + + :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 filter: OData filter expression. Valid properties for filtering are userprincipalname + and sessionstate. Default value is None. + :type filter: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.UserSessionList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + filter=filter, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("UserSessionList", 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/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py index 94b8a7955f8e..68386a9b384e 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,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,28 +39,19 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + 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/workspaces/{workspaceName}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces" + ) 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 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -75,51 +65,57 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces", ) # 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 ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", max_length=64, 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") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if is_descending is not None: + _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") + if initial_skip is not None: + _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_get_request( resource_group_name: str, workspace_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-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,16 +141,16 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_create_or_update_request( resource_group_name: str, workspace_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-04-03")) + 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") @@ -183,66 +179,69 @@ def build_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any +def build_update_request( + resource_group_name: str, workspace_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-04-03")) + 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/workspaces", + "/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"), "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, 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") - if page_size is not None: - _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") - if is_descending is not None: - _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") - if initial_skip is not None: - _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_delete_request( + resource_group_name: str, workspace_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-04-03")) + 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/workspaces" - ) + "template_url", + "/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"), + "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, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -253,7 +252,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class WorkspacesOperations: @@ -275,6 +274,176 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: + """List workspaces in subscription. + + :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: + """ + _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.WorkspaceList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("WorkspaceList", 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_resource_group( + self, + resource_group_name: str, + page_size: Optional[int] = None, + is_descending: Optional[bool] = None, + initial_skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.Workspace"]: + """List workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param page_size: Number of items per page. Default value is None. + :type page_size: int + :param is_descending: Indicates whether the collection is descending. Default value is None. + :type is_descending: bool + :param initial_skip: Initial number of items to skip. Default value is None. + :type initial_skip: int + :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: + """ + _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.WorkspaceList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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, + page_size=page_size, + is_descending=is_descending, + initial_skip=initial_skip, + 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("WorkspaceList", 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 get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Get a workspace. @@ -288,7 +457,7 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +490,8 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -406,7 +576,7 @@ def create_or_update( :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,7 +621,8 @@ def create_or_update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -460,59 +631,6 @@ def create_or_update( return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: - """Remove a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the workspace. Required. - :type workspace_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_delete_request( - resource_group_name=resource_group_name, - workspace_name=workspace_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, 204]: - 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 - @overload def update( self, @@ -530,7 +648,7 @@ def 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. Default value is None. + :param workspace: The resource properties to be updated. Default value is None. :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -557,7 +675,7 @@ def 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. Default value is None. + :param workspace: The resource properties to be updated. Default value is None. :type workspace: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -582,14 +700,14 @@ def 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 WorkspacePatch type or a + :param workspace: The resource properties to be updated. Is either a WorkspacePatch type or a 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: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -637,7 +755,8 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workspace", pipeline_response.http_response) @@ -647,36 +766,21 @@ def update( return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - page_size: Optional[int] = None, - is_descending: Optional[bool] = None, - initial_skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Workspace"]: - """List workspaces. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> None: + """Remove a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param page_size: Number of items per page. Default value is None. - :type page_size: int - :param is_descending: Indicates whether the collection is descending. Default value is None. - :type is_descending: bool - :param initial_skip: Initial number of items to skip. Default value is None. - :type initial_skip: int - :return: An iterator like instance of either Workspace or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.Workspace] + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,132 +788,33 @@ def list_by_resource_group( } 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, - page_size=page_size, - is_descending=is_descending, - initial_skip=initial_skip, - 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("WorkspaceList", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Workspace"]: - """List workspaces in subscription. - - :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: - """ _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.WorkspaceList] = 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, - 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("WorkspaceList", 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) + cls: ClsType[None] = kwargs.pop("cls", None) - def get_next(next_link=None): - _request = prepare_request(next_link) + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - 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) + response = pipeline_response.http_response - return pipeline_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) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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_or_update.py similarity index 95% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create_or_update.py index 1a3d9fc1eb08..3334cd9b7806 100644 --- 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_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python app_attach_package_create.py + python app_attach_package_create_or_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, @@ -78,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackage_CreateOrUpdate.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 index dbae419122ab..818145419468 100644 --- 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Delete.json +# 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 index d3306b7757cc..cb030ccb331d 100644 --- 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json +# 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.py similarity index 86% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import.py index 2c297780686a..ba616982181b 100644 --- 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.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python app_attach_package_info_import_post.py + python app_attach_package_info_import.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, @@ -33,12 +33,11 @@ def main(): 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/stable/2024-04-03/examples/AppAttachPackageInfo_Import_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/AppAttachPackageInfo_Import.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py index 3bfdde166329..74937e2fd0d5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListByResourceGroup.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 index fb648e62a071..427430ace695 100644 --- 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListBySubscription.json +# 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 index 0b1239001f98..473e11c8a2d0 100644 --- 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Update.json +# 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_group_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_create_or_update.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_create_or_update.py index 95aff0aff571..5a3004158245 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_create_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_create.py + python application_groups_create_or_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, @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_CreateOrUpdate.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_groups_delete.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_delete.py index 22df1d08fa55..340633ee94df 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_delete.py + python application_groups_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, @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_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_groups_get.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_get.py index 25c26db4e667..8276935fa932 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_get.py + python application_groups_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_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_groups_list_by_resource_group.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_list_by_resource_group.py index 0f30342aa9f3..8399499be5da 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_groups_list_by_resource_group.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_list_by_resource_group.py + python application_groups_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_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_groups_list_by_subscription.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_list_by_subscription.py index 514eaf021932..b1d5056b74e5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_list_by_subscription.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_list_by_subscription.py + python application_groups_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, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_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_groups_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_update.py index a618dce1d629..a1f8cea63385 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_groups_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_group_update.py + python application_groups_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ApplicationGroups_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/applications_create_or_update.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_create_or_update.py index 0e99c30581fb..04ba0b75c1dc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_create_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_create.py + python applications_create_or_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, @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Applications_CreateOrUpdate.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/applications_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_delete.py index 849f2aadaafb..6f0479ec6cc8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_delete.py + python applications_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Applications_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/applications_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_get.py index 1ea6ce092768..560758a5e3a4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_get.py + python applications_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Applications_Get.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/applications_list.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_list.py index 0c964e1fbb90..640d36902c59 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_list.py + python applications_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Applications_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/applications_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_update.py index 1a5f906da636..b2650e3f377f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/applications_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python application_update.py + python applications_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Applications_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/desktops_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_get.py index 18b47790ea7d..1a765aef9344 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python desktop_get.py + python desktops_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktops_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/desktops_list.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_list.py index 753ecea64156..283a396d4ac3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python desktop_list.py + python desktops_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktops_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/desktops_update.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_update.py index b358a4f54be6..bba963bab714 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktops_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python desktop_update.py + python desktops_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Desktops_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_or_update.py similarity index 88% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create_or_update.py index 1da2cef16c77..862b6d78cc48 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_create.py + python host_pool_create_or_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, @@ -44,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", @@ -67,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_CreateOrUpdate.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_lists.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_lists.py index aa25e869679a..d6b82cdff5cd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_lists.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_list.py + python host_pool_lists.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, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPool_Lists.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_pools_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_delete.py index c35977b4394e..792d618fcbc4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_delete.py + python host_pools_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, @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_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_pools_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_get.py index bfc0c17fe097..4ddb0e20f23a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_get.py + python host_pools_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_Get.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_pools_list_by_resource_group.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_by_resource_group.py index 50c8e0015963..c02aac92a3ce 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_pools_list_by_resource_group.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_list_by_resource_group.py + python host_pools_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_ListByResourceGroup.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_tokens.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_tokens.py index b808f45751fe..6a1ce7ff95e6 100644 --- 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_tokens.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pools_list_registration_token_post.py + python host_pools_list_registration_tokens.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_ListRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_ListRegistrationTokens.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.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token.py index a46f233a7b41..e9baaf6a79e5 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.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pools_retrieve_registration_token_post.py + python host_pools_retrieve_registration_token.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_RetrieveRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_RetrieveRegistrationToken.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_pools_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_update.py index df9f0ded78f4..cc9b4e09c4b2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python host_pool_update.py + python host_pools_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/HostPools_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_images_expand.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_images_expand.py new file mode 100644 index 000000000000..5d30b6213de0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_images_expand.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 msix_images_expand.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.msix_images.expand( + 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/MsixImages_Expand.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_packages_create_or_update.py similarity index 94% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_create_or_update.py index b3d1ee6faf49..d6562fa18c19 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_create_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_package_create.py + python msix_packages_create_or_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, @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackages_CreateOrUpdate.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_packages_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_delete.py index 35396a87ea47..5f2ba20f0e2d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_package_delete.py + python msix_packages_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackages_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_packages_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_get.py index 122d3ac8bc1a..e71aed865e97 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_package_get.py + python msix_packages_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MSIXPackages_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_packages_list.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_list.py index bdf2b76e629d..7ab4ae1d494a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_package_list.py + python msix_packages_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MSIXPackages_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_packages_update.py similarity index 85% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_update.py index 816aede3d0d0..fe2fd647cc74 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_packages_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python msix_package_update.py + python msix_packages_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, @@ -34,10 +34,11 @@ def main(): resource_group_name="resourceGroup1", host_pool_name="hostpool1", msix_package_full_name="msixpackagefullname", + msix_package={"properties": {"displayName": "displayname", "isActive": True, "isRegularRegistration": False}}, ) print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/MsixPackages_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/operations_list.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operations_list.py index 7ba9404dee7d..606c33f6ba66 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operations_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python operation_description_list.py + python operations_list.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, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/OperationDescription_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Operations_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_connections_delete_by_host_pool.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_delete_by_host_pool.py index ee41840691d3..c17b16c9f8cd 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_connections_delete_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_delete_by_host_pool.py + python private_endpoint_connections_delete_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_delete_by_workspace.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_delete_by_workspace.py index 15a006caf960..0d3ec9974078 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_connections_delete_by_workspace.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_delete_by_workspace.py + python private_endpoint_connections_delete_by_workspace.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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_get_by_host_pool.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_get_by_host_pool.py index f8660d4b0a81..61da2e83fe26 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_connections_get_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_get_by_host_pool.py + python private_endpoint_connections_get_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_get_by_workspace.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_get_by_workspace.py index f9b0589a2b64..373065109f73 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_connections_get_by_workspace.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_get_by_workspace.py + python private_endpoint_connections_get_by_workspace.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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_list_by_host_pool.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_list_by_host_pool.py index 6d5201a27ce5..056917cee074 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_connections_list_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_list_by_host_pool.py + python private_endpoint_connections_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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_list_by_workspace.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_list_by_workspace.py index 6c41ad8e1512..2fd4bdc56679 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_connections_list_by_workspace.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_list_by_workspace.py + python private_endpoint_connections_list_by_workspace.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_update_by_host_pool.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_update_by_host_pool.py index 5b17bbde82ed..98bef2adcb04 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_connections_update_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_update_by_host_pool.py + python private_endpoint_connections_update_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, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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_connections_update_by_workspace.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connections_update_by_workspace.py index 8a10de65dfa8..66b4f4d2661a 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_connections_update_by_workspace.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python private_endpoint_connection_update_by_workspace.py + python private_endpoint_connections_update_by_workspace.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, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/PrivateEndpointConnections_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 9374072152e6..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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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 da8ec5caceee..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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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_personal_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_create.py similarity index 94% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_create.py index 4055e6b7e02b..6bff55094e23 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_schedules_create.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_personal_schedule_create.py + python scaling_plan_personal_schedules_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, @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedules_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_schedules_delete.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_delete.py index 77b4b85fa9a1..7ae9db5076c5 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_schedules_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_personal_schedule_delete.py + python scaling_plan_personal_schedules_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedules_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_schedules_get.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_get.py index 14d7e4d9b927..ebc2239895fc 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_schedules_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_personal_schedule_get.py + python scaling_plan_personal_schedules_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedules_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_schedules_list.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_list.py index a1f7eb130178..48068ab7d5d1 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_schedules_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_personal_schedule_list.py + python scaling_plan_personal_schedules_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedules_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_schedules_update.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedules_update.py index ce57fd0e33db..ce6115e9067e 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_schedules_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_personal_schedule_update.py + python scaling_plan_personal_schedules_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPersonalSchedules_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_schedules_create.py similarity index 93% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedules_create.py index c02ca159aaed..d31a0b18d230 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_schedules_create.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_pooled_schedule_create.py + python scaling_plan_pooled_schedules_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, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedules_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_schedules_delete.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedules_delete.py index f2d90dec35c5..45367a8fb393 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_schedules_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_pooled_schedule_delete.py + python scaling_plan_pooled_schedules_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedules_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_schedules_get.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedules_get.py index da2a627f4692..c1ca0803175b 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_schedules_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_pooled_schedule_get.py + python scaling_plan_pooled_schedules_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedules_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_schedules_list.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedules_list.py index 82033bd51b3a..e19baf9951d0 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_schedules_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_pooled_schedule_list.py + python scaling_plan_pooled_schedules_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedules_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_schedules_update.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedules_update.py index cf4ad0c45745..8027a9648644 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_schedules_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_pooled_schedule_update.py + python scaling_plan_pooled_schedules_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlanPooledSchedules_Update.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_plans_create.py similarity index 96% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_create.py index 2ccfc35fb645..e6f24f42e290 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_create.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_create.py + python scaling_plans_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, @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_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_plans_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_delete.py index f627b071de76..8f917b2ba460 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_delete.py + python scaling_plans_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, @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_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_plans_get.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_get.py index b40c90aa5902..6ae48384cf60 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_get.py + python scaling_plans_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_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_plans_list_by_host_pool.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_list_by_host_pool.py index c3635c78f0da..e8ea028e898d 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_plans_list_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_list_by_host_pool.py + python scaling_plans_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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_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_plans_list_by_resource_group.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_list_by_resource_group.py index b92cc80c5a82..c8fd446287c6 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_plans_list_by_resource_group.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_list_by_resource_group.py + python scaling_plans_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_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_plans_list_by_subscription.py similarity index 89% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_list_by_subscription.py index b08092ed37bb..929babfd6e4d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_list_by_subscription.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_list_by_subscription.py + python scaling_plans_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, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_ListBySubscription.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_plans_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_update.py index ec6e2d3e7eaf..cd39c9d10c27 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plans_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python scaling_plan_update.py + python scaling_plans_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/ScalingPlans_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create_or_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create_or_update.py new file mode 100644 index 000000000000..ebd5829aef95 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create_or_update.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_or_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_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_CreateOrUpdate.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_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..24426be8199c --- /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/SessionHostManagementsUpdateStatus_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..37730bdd9df4 --- /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_hosts.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_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_delete.py index 37aaf96a7d31..b6b100c33b59 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python session_host_delete.py + python session_hosts_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, @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHosts_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_hosts_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_get.py index cd1a39e42ce4..57f1ea2484d5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python session_host_get.py + python session_hosts_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHosts_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_hosts_list.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_list.py index 59df6423ee56..fbccc9eef820 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python session_host_list.py + python session_hosts_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHosts_List.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_hosts_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_update.py index 66a906828b50..608c5df4cdae 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_hosts_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python session_host_update.py + python session_hosts_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, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/SessionHosts_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_items_list.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_items_list.py index 3947795d4bc0..7798b1c41703 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_items_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python start_menu_item_list.py + python start_menu_items_list.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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/StartMenuItem_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/StartMenuItems_List.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 1c2dd0b04134..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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_delete.py index 9795cd6b3ea7..6be5c68aa15f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python user_session_delete.py + python user_sessions_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, @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSessions_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_sessions_disconnect.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_disconnect.py index 56a22a9a2d33..5e7af53b820c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_disconnect.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python user_session_disconnect_post.py + python user_sessions_disconnect.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, @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Disconnect_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSessions_Disconnect.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_sessions_list.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_list.py index 37e3dff31c75..bc374733318e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python user_session_list.py + python user_sessions_list.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, @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSessions_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_sessions_list_by_host_pool.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_list_by_host_pool.py index 7ece20e47752..7b8ac2675a7f 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_sessions_list_by_host_pool.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python user_session_list_by_host_pool.py + python user_sessions_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, @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSessions_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_sessions_send_message.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_send_message.py index f3f3889c48e4..6944d3f8c731 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_sessions_send_message.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python user_session_send_message_post.py + python user_sessions_send_message.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, @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_SendMessage_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/UserSessions_SendMessage.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/workspaces_create_or_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_create_or_update.py index 3d2e16c4b669..0bc2088534cf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_create_or_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_create.py + python workspaces_create_or_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, @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_CreateOrUpdate.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/workspaces_delete.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_delete.py index 8c8f3f1bc584..754a562bf03a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_delete.py + python workspaces_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, @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_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/workspaces_get.py similarity index 92% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_get.py index 32696811908c..6a21b9abee84 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_get.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_get.py + python workspaces_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_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/workspaces_list_by_resource_group.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_list_by_resource_group.py index c9341a79edc5..438516b0e718 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_list_by_resource_group.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_list_by_resource_group.py + python workspaces_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_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/workspaces_list_by_subscription.py similarity index 90% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_list_by_subscription.py index c21d95f4c0ee..e347b50c6cac 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_list_by_subscription.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_list_by_subscription.py + python workspaces_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, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_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/workspaces_update.py similarity index 91% rename from sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py rename to sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_update.py index ad8e24ed16eb..cc88e0698687 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspaces_update.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-desktopvirtualization # USAGE - python workspace_update.py + python workspaces_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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-08-08-preview/examples/Workspaces_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 index 2bacd7394e96..b919673dd65c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): desktopvirtualizationmgmt_subscription_id = os.environ.get( 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..d1f248a21589 --- /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_active_session_host_configurations_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_active_session_host_configurations_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 + # ... 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..6fc834302b86 --- /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_active_session_host_configurations_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_active_session_host_configurations_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 + # ... 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 index c5eae9ca9116..ceed5fee2eee 100644 --- 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 @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_import_method(self, resource_group): + def test_app_attach_package_info_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-04-03", + 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 index 381ce67c0991..e9e603ea3932 100644 --- 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 @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_import_method(self, resource_group): + async def test_app_attach_package_info_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-04-03", + 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 index 2714c590f452..2535308f3db1 100644 --- 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 @@ -20,11 +20,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_app_attach_package_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_app_attach_package_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_app_attach_package_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -32,48 +53,49 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_app_attach_package_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": { - "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", - "provisioningState": "str", - }, + "customData": "str", + "failHealthCheckOnStagingFailure": "str", + "hostPoolReferences": ["str"], "id": "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", "name": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", + "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -85,19 +107,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", - ) - - # 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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -105,11 +115,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_app_attach_package_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -117,21 +127,12 @@ def test_update(self, resource_group): @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( + def test_app_attach_package_delete(self, resource_group): + response = self.client.app_attach_package.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + app_attach_package_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_subscription(self, resource_group): - response = self.client.app_attach_package.list_by_subscription( - api_version="2024-04-03", - ) - 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 index fd872a32f0a4..1d2993bbfa1a 100644 --- 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 @@ -21,11 +21,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_app_attach_package_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_app_attach_package_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_app_attach_package_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,48 +54,49 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_app_attach_package_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": { - "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", - "provisioningState": "str", - }, + "customData": "str", + "failHealthCheckOnStagingFailure": "str", + "hostPoolReferences": ["str"], "id": "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", "name": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", + "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -86,19 +108,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", - ) - - # 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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -106,11 +116,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_app_attach_package_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -118,21 +128,12 @@ async def test_update(self, resource_group): @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( + async def test_app_attach_package_delete(self, resource_group): + response = await self.client.app_attach_package.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + app_attach_package_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_subscription(self, resource_group): - response = self.client.app_attach_package.list_by_subscription( - api_version="2024-04-03", - ) - 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 index d1193ef29383..79a29d638ec9 100644 --- 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 @@ -20,11 +20,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_application_groups_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_application_groups_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_application_groups_get(self, resource_group): response = self.client.application_groups.get( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -32,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_application_groups_create_or_update(self, resource_group): response = self.client.application_groups.create_or_update( resource_group_name=resource_group.name, application_group_name="str", @@ -45,7 +66,12 @@ def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -65,7 +91,7 @@ def test_create_or_update(self, resource_group): "type": "str", "workspaceArmPath": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -73,23 +99,11 @@ def test_create_or_update(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_update(self, resource_group): + def test_application_groups_update(self, resource_group): response = self.client.application_groups.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -97,21 +111,12 @@ def test_update(self, resource_group): @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( + def test_application_groups_delete(self, resource_group): + response = self.client.application_groups.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + application_group_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_subscription(self, resource_group): - response = self.client.application_groups.list_by_subscription( - api_version="2024-04-03", - ) - 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 index 9f61dc9eeea4..5bdff9a9402c 100644 --- 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 @@ -21,11 +21,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_application_groups_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_application_groups_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_application_groups_get(self, resource_group): response = await self.client.application_groups.get( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_application_groups_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", @@ -46,7 +67,12 @@ async def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -66,7 +92,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "workspaceArmPath": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -74,23 +100,11 @@ async def test_create_or_update(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_application_groups_update(self, resource_group): response = await self.client.application_groups.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -98,21 +112,12 @@ async def test_update(self, resource_group): @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( + async def test_application_groups_delete(self, resource_group): + response = await self.client.application_groups.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + 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 - # ... - @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-04-03", - ) - 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 index c5e68ba8dec0..6daedbe01132 100644 --- 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 @@ -20,12 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_applications_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_applications_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_applications_create_or_update(self, resource_group): response = self.client.applications.create_or_update( resource_group_name=resource_group.name, application_group_name="str", @@ -65,7 +77,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -73,12 +85,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.applications.delete( + def test_applications_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -86,25 +98,13 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.applications.update( + def test_applications_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-04-03", + 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-04-03", - ) - 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 index 1490dbd499c1..e28b6ab9e328 100644 --- 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 @@ -21,12 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_applications_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_applications_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -34,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_applications_create_or_update(self, resource_group): response = await self.client.applications.create_or_update( resource_group_name=resource_group.name, application_group_name="str", @@ -66,7 +78,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -74,12 +86,12 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.applications.delete( + async def test_applications_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -87,25 +99,13 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.applications.update( + async def test_applications_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-04-03", + 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-04-03", - ) - 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..7676ab092ace --- /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_control_session_host_update_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..18c26f2641e4 --- /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_control_session_host_update_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 index 3f5ea7c08f41..d2445c3db46c 100644 --- 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 @@ -20,25 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): - response = self.client.desktops.get( + def test_desktops_list(self, resource_group): + response = self.client.desktops.list( resource_group_name=resource_group.name, application_group_name="str", - desktop_name="str", - api_version="2024-04-03", + 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_update(self, resource_group): - response = self.client.desktops.update( + def test_desktops_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -46,12 +45,13 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): - response = self.client.desktops.list( + def test_desktops_update(self, resource_group): + response = self.client.desktops.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + desktop_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 index 76f5dff1b61a..a7a034795bd7 100644 --- 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 @@ -21,25 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): - response = await self.client.desktops.get( + async def test_desktops_list(self, resource_group): + response = self.client.desktops.list( resource_group_name=resource_group.name, application_group_name="str", - desktop_name="str", - api_version="2024-04-03", + 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_update(self, resource_group): - response = await self.client.desktops.update( + async def test_desktops_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -47,12 +46,13 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): - response = self.client.desktops.list( + async def test_desktops_update(self, resource_group): + response = await self.client.desktops.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + desktop_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 index 73087acdd2ba..1029db3edd14 100644 --- 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 @@ -20,11 +20,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_host_pools_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_host_pools_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_host_pools_get(self, resource_group): response = self.client.host_pools.get( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -32,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_host_pools_create_or_update(self, resource_group): response = self.client.host_pools.create_or_update( resource_group_name=resource_group.name, host_pool_name="str", @@ -52,12 +73,20 @@ def test_create_or_update(self, resource_group): "cloudPcResource": bool, "customRdpProperty": "str", "description": "str", + "directUDP": "str", "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "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", @@ -65,16 +94,18 @@ def test_create_or_update(self, resource_group): "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", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,11 +118,13 @@ def test_create_or_update(self, resource_group): } ], "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", @@ -112,19 +145,7 @@ def test_create_or_update(self, resource_group): "validationEnvironment": bool, "vmTemplate": "str", }, - api_version="2024-04-03", - ) - - # 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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -132,11 +153,11 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_host_pools_update(self, resource_group): response = self.client.host_pools.update( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -144,32 +165,23 @@ def test_update(self, resource_group): @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( + def test_host_pools_delete(self, resource_group): + response = self.client.host_pools.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + 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_list(self, resource_group): - response = self.client.host_pools.list( - api_version="2024-04-03", - ) - 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( + def test_host_pools_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -177,11 +189,11 @@ def test_retrieve_registration_token(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_registration_tokens(self, resource_group): - response = self.client.host_pools.list_registration_tokens( + def test_host_pools_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-04-03", + 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 index 4433fbe943d4..a0fccc8b7877 100644 --- 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 @@ -21,11 +21,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_host_pools_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_host_pools_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_host_pools_get(self, resource_group): response = await self.client.host_pools.get( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_host_pools_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", @@ -53,12 +74,20 @@ async def test_create_or_update(self, resource_group): "cloudPcResource": bool, "customRdpProperty": "str", "description": "str", + "directUDP": "str", "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "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", @@ -66,16 +95,18 @@ async def test_create_or_update(self, resource_group): "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", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -88,11 +119,13 @@ async def test_create_or_update(self, resource_group): } ], "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", @@ -113,19 +146,7 @@ async def test_create_or_update(self, resource_group): "validationEnvironment": bool, "vmTemplate": "str", }, - api_version="2024-04-03", - ) - - # 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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -133,11 +154,11 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_host_pools_update(self, resource_group): response = await self.client.host_pools.update( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -145,32 +166,23 @@ async def test_update(self, resource_group): @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( + async def test_host_pools_delete(self, resource_group): + response = await self.client.host_pools.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + 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_list(self, resource_group): - response = self.client.host_pools.list( - api_version="2024-04-03", - ) - 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( + async def test_host_pools_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -178,11 +190,11 @@ async def test_retrieve_registration_token(self, resource_group): @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( + async def test_host_pools_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-04-03", + 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..071c49aecfb0 --- /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_initiate_session_host_update_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..41302ec0cc77 --- /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_initiate_session_host_update_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 index e78b749b217e..67f8debf64b9 100644 --- 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 @@ -20,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_expand(self, resource_group): + def test_msix_images_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-04-03", + 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 index 05b1c49cf285..43332d31af37 100644 --- 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 @@ -21,12 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_expand(self, resource_group): + async def test_msix_images_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-04-03", + 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 index a1f949c00531..0498cbfe0cc6 100644 --- 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 @@ -20,12 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_msix_packages_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_msix_packages_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_msix_packages_create_or_update(self, resource_group): response = self.client.msix_packages.create_or_update( resource_group_name=resource_group.name, host_pool_name="str", @@ -72,7 +84,7 @@ def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -80,12 +92,26 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.msix_packages.delete( + def test_msix_packages_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-04-03", + msix_package={ + "id": "str", + "name": "str", + "properties": {"displayName": "str", "isActive": bool, "isRegularRegistration": 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 @@ -93,25 +119,13 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.msix_packages.update( + def test_msix_packages_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-04-03", + 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-04-03", - ) - 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 index 5a015587b120..218a3500e8cb 100644 --- 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 @@ -21,12 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_msix_packages_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_msix_packages_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -34,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_msix_packages_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", @@ -73,7 +85,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -81,12 +93,26 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.msix_packages.delete( + async def test_msix_packages_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-04-03", + msix_package={ + "id": "str", + "name": "str", + "properties": {"displayName": "str", "isActive": bool, "isRegularRegistration": 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 @@ -94,25 +120,13 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.msix_packages.update( + async def test_msix_packages_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-04-03", + 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-04-03", - ) - 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 index 19082f23bd75..cf14c2639491 100644 --- 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 @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-03", + 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 index c1370b13dc27..345288192d60 100644 --- 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 @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-03", + 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 index a8bee2db3763..4872a5f5cbbb 100644 --- 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 @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_workspace(self, resource_group): - response = self.client.private_endpoint_connections.list_by_workspace( + def test_private_endpoint_connections_list_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.list_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", - api_version="2024-04-03", + host_pool_name="str", + api_version="2024-08-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,25 +32,12 @@ def test_list_by_workspace(self, resource_group): @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-04-03", - ) - - # 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( + def test_private_endpoint_connections_get_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.get_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", + host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -58,10 +45,10 @@ def test_delete_by_workspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update_by_workspace(self, resource_group): - response = self.client.private_endpoint_connections.update_by_workspace( + def test_private_endpoint_connections_update_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.update_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", + host_pool_name="str", private_endpoint_connection_name="str", connection={ "groupIds": ["str"], @@ -80,7 +67,7 @@ def test_update_by_workspace(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -88,37 +75,37 @@ def test_update_by_workspace(self, resource_group): @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( + def test_private_endpoint_connections_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", - api_version="2024-04-03", + private_endpoint_connection_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( + def test_private_endpoint_connections_list_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.list_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", - private_endpoint_connection_name="str", - api_version="2024-04-03", + 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_delete_by_host_pool(self, resource_group): - response = self.client.private_endpoint_connections.delete_by_host_pool( + def test_private_endpoint_connections_get_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.get_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", + workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -126,10 +113,10 @@ def test_delete_by_host_pool(self, resource_group): @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( + def test_private_endpoint_connections_update_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.update_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", + workspace_name="str", private_endpoint_connection_name="str", connection={ "groupIds": ["str"], @@ -148,7 +135,20 @@ def test_update_by_host_pool(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_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 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 index e871e0546acb..6aa039b1a669 100644 --- 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 @@ -21,11 +21,11 @@ def setup_method(self, method): @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( + async def test_private_endpoint_connections_list_by_host_pool(self, resource_group): + response = self.client.private_endpoint_connections.list_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", - api_version="2024-04-03", + 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 @@ -33,25 +33,12 @@ async def test_list_by_workspace(self, resource_group): @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-04-03", - ) - - # 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( + async def test_private_endpoint_connections_get_by_host_pool(self, resource_group): + response = await self.client.private_endpoint_connections.get_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", + host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -59,10 +46,10 @@ async def test_delete_by_workspace(self, resource_group): @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( + async def test_private_endpoint_connections_update_by_host_pool(self, resource_group): + response = await self.client.private_endpoint_connections.update_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", + host_pool_name="str", private_endpoint_connection_name="str", connection={ "groupIds": ["str"], @@ -81,7 +68,7 @@ async def test_update_by_workspace(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -89,37 +76,37 @@ async def test_update_by_workspace(self, resource_group): @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( + async def test_private_endpoint_connections_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", - api_version="2024-04-03", + private_endpoint_connection_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( + async def test_private_endpoint_connections_list_by_workspace(self, resource_group): + response = self.client.private_endpoint_connections.list_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", - private_endpoint_connection_name="str", - api_version="2024-04-03", + 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_delete_by_host_pool(self, resource_group): - response = await self.client.private_endpoint_connections.delete_by_host_pool( + async def test_private_endpoint_connections_get_by_workspace(self, resource_group): + response = await self.client.private_endpoint_connections.get_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", + workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -127,10 +114,10 @@ async def test_delete_by_host_pool(self, resource_group): @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( + async def test_private_endpoint_connections_update_by_workspace(self, resource_group): + response = await self.client.private_endpoint_connections.update_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", + workspace_name="str", private_endpoint_connection_name="str", connection={ "groupIds": ["str"], @@ -149,7 +136,20 @@ async def test_update_by_host_pool(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + 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_private_endpoint_connections_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 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 index 5048e8fd8bf0..2d57a23bb1d0 100644 --- 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 @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_workspace(self, resource_group): - response = self.client.private_link_resources.list_by_workspace( + def test_private_link_resources_list_by_host_pool(self, resource_group): + response = self.client.private_link_resources.list_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", - api_version="2024-04-03", + host_pool_name="str", + api_version="2024-08-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,11 +32,11 @@ def test_list_by_workspace(self, resource_group): @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( + def test_private_link_resources_list_by_workspace(self, resource_group): + response = self.client.private_link_resources.list_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", - api_version="2024-04-03", + workspace_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 index c7abaa0bb8f6..7c16af63c21b 100644 --- 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 @@ -21,11 +21,11 @@ def setup_method(self, method): @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( + async def test_private_link_resources_list_by_host_pool(self, resource_group): + response = self.client.private_link_resources.list_by_host_pool( resource_group_name=resource_group.name, - workspace_name="str", - api_version="2024-04-03", + 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 @@ -33,11 +33,11 @@ async def test_list_by_workspace(self, resource_group): @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( + async def test_private_link_resources_list_by_workspace(self, resource_group): + response = self.client.private_link_resources.list_by_workspace( resource_group_name=resource_group.name, - host_pool_name="str", - api_version="2024-04-03", + workspace_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 index d4536d8b1c08..feaead54ed66 100644 --- 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 @@ -20,12 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_scaling_plan_personal_schedules_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scaling_plan_personal_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,39 +45,39 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_scaling_plan_personal_schedules_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, - "offPeakStartTime": {"hour": 0, "minute": 0}, "offPeakStartVMOnConnect": "str", "peakActionOnDisconnect": "str", "peakActionOnLogoff": "str", "peakMinutesToWaitOnDisconnect": 0, "peakMinutesToWaitOnLogoff": 0, - "peakStartTime": {"hour": 0, "minute": 0}, "peakStartVMOnConnect": "str", "rampDownActionOnDisconnect": "str", "rampDownActionOnLogoff": "str", "rampDownMinutesToWaitOnDisconnect": 0, "rampDownMinutesToWaitOnLogoff": 0, - "rampDownStartTime": {"hour": 0, "minute": 0}, "rampDownStartVMOnConnect": "str", "rampUpActionOnDisconnect": "str", "rampUpActionOnLogoff": "str", "rampUpAutoStartHosts": "str", "rampUpMinutesToWaitOnDisconnect": 0, "rampUpMinutesToWaitOnLogoff": 0, - "rampUpStartTime": {"hour": 0, "minute": 0}, "rampUpStartVMOnConnect": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -77,7 +89,7 @@ def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -85,12 +97,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.scaling_plan_personal_schedules.delete( + def test_scaling_plan_personal_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -98,25 +110,13 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.scaling_plan_personal_schedules.update( + def test_scaling_plan_personal_schedules_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-04-03", + 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-04-03", - ) - 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 index cb66793c9144..27221e2104ab 100644 --- 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 @@ -21,12 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_scaling_plan_personal_schedules_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scaling_plan_personal_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -34,39 +46,39 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_scaling_plan_personal_schedules_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, - "offPeakStartTime": {"hour": 0, "minute": 0}, "offPeakStartVMOnConnect": "str", "peakActionOnDisconnect": "str", "peakActionOnLogoff": "str", "peakMinutesToWaitOnDisconnect": 0, "peakMinutesToWaitOnLogoff": 0, - "peakStartTime": {"hour": 0, "minute": 0}, "peakStartVMOnConnect": "str", "rampDownActionOnDisconnect": "str", "rampDownActionOnLogoff": "str", "rampDownMinutesToWaitOnDisconnect": 0, "rampDownMinutesToWaitOnLogoff": 0, - "rampDownStartTime": {"hour": 0, "minute": 0}, "rampDownStartVMOnConnect": "str", "rampUpActionOnDisconnect": "str", "rampUpActionOnLogoff": "str", "rampUpAutoStartHosts": "str", "rampUpMinutesToWaitOnDisconnect": 0, "rampUpMinutesToWaitOnLogoff": 0, - "rampUpStartTime": {"hour": 0, "minute": 0}, "rampUpStartVMOnConnect": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -78,7 +90,7 @@ async def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -86,12 +98,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.scaling_plan_personal_schedules.delete( + async def test_scaling_plan_personal_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -99,25 +111,13 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.scaling_plan_personal_schedules.update( + async def test_scaling_plan_personal_schedules_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-04-03", + 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-04-03", - ) - 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 index 973ae0f894fa..8e0f7d9d0107 100644 --- 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 @@ -20,12 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_scaling_plan_pooled_schedules_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scaling_plan_pooled_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,31 +45,31 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_scaling_plan_pooled_schedules_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", - "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}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -68,7 +80,7 @@ def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -76,12 +88,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.scaling_plan_pooled_schedules.delete( + def test_scaling_plan_pooled_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -89,25 +101,13 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.scaling_plan_pooled_schedules.update( + def test_scaling_plan_pooled_schedules_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-04-03", + 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-04-03", - ) - 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 index 9ff2d9868812..031748d9fdf2 100644 --- 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 @@ -21,12 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_scaling_plan_pooled_schedules_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scaling_plan_pooled_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -34,31 +46,31 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_scaling_plan_pooled_schedules_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", - "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}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -69,7 +81,7 @@ async def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -77,12 +89,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.scaling_plan_pooled_schedules.delete( + async def test_scaling_plan_pooled_schedules_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -90,25 +102,13 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.scaling_plan_pooled_schedules.update( + async def test_scaling_plan_pooled_schedules_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-04-03", + 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-04-03", - ) - 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 index cee2eaae558d..224fcc860510 100644 --- 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 @@ -20,11 +20,44 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_scaling_plans_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_scaling_plans_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scaling_plans_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_scaling_plans_get(self, resource_group): response = self.client.scaling_plans.get( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -32,7 +65,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_scaling_plans_create(self, resource_group): response = self.client.scaling_plans.create( resource_group_name=resource_group.name, scaling_plan_name="str", @@ -46,7 +79,12 @@ def test_create(self, resource_group): "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], "hostPoolType": "Pooled", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -86,7 +124,7 @@ def test_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -94,23 +132,11 @@ def test_create(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_update(self, resource_group): + def test_scaling_plans_update(self, resource_group): response = self.client.scaling_plans.update( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -118,33 +144,12 @@ def test_update(self, resource_group): @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( + def test_scaling_plans_delete(self, resource_group): + response = self.client.scaling_plans.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", - ) - 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-04-03", + scaling_plan_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.scaling_plans.list_by_host_pool( - resource_group_name=resource_group.name, - host_pool_name="str", - api_version="2024-04-03", - ) - 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 index bb5c7899e80d..dc99832cefa2 100644 --- 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 @@ -21,11 +21,44 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_scaling_plans_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_scaling_plans_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scaling_plans_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_scaling_plans_get(self, resource_group): response = await self.client.scaling_plans.get( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +66,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_scaling_plans_create(self, resource_group): response = await self.client.scaling_plans.create( resource_group_name=resource_group.name, scaling_plan_name="str", @@ -47,7 +80,12 @@ async def test_create(self, resource_group): "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], "hostPoolType": "Pooled", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -87,7 +125,7 @@ async def test_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -95,23 +133,11 @@ async def test_create(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_scaling_plans_update(self, resource_group): response = await self.client.scaling_plans.update( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -119,33 +145,12 @@ async def test_update(self, resource_group): @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( + async def test_scaling_plans_delete(self, resource_group): + response = await self.client.scaling_plans.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", - ) - 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-04-03", + 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 - # ... - @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-04-03", - ) - 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..d086e022c3dc --- /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_session_host_configurations_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_session_host_configurations_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_session_host_configurations_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={ + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "friendlyName": "str", + "id": "str", + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "name": "str", + "networkInfo": {"subnetId": "str", "securityGroupId": "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", + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmLocation": "str", + "vmNamePrefix": "str", + "vmResourceGroup": "str", + "vmSizeId": "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_session_host_configurations_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 + # ... 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..5d9bfbda7e1a --- /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_session_host_configurations_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_session_host_configurations_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_session_host_configurations_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={ + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "str", + "usernameKeyVaultSecretUri": "str", + }, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "friendlyName": "str", + "id": "str", + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "name": "str", + "networkInfo": {"subnetId": "str", "securityGroupId": "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", + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmLocation": "str", + "vmNamePrefix": "str", + "vmResourceGroup": "str", + "vmSizeId": "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_session_host_configurations_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 + # ... 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..28ad1e49c20d --- /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_session_host_managements_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_session_host_managements_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_session_host_managements_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_session_host_managements_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 + # ... 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..e3fe6976d3e8 --- /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_session_host_managements_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_session_host_managements_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_session_host_managements_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_session_host_managements_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 + # ... 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..6e3c3423884d --- /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_session_host_managements_update_status_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..67c7e113b935 --- /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_session_host_managements_update_status_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_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py index f6da35d6d8da..c906f56ed34e 100644 --- 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 @@ -20,12 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_session_hosts_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.session_hosts.delete( + def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -46,12 +58,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.session_hosts.update( + def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -59,12 +71,13 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): - response = self.client.session_hosts.list( + def test_session_hosts_retry_provisioning(self, resource_group): + response = self.client.session_hosts.retry_provisioning( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + session_host_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 index 3760951a7af3..5d123f9919b0 100644 --- 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 @@ -21,12 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_session_hosts_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -34,12 +46,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.session_hosts.delete( + async def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -47,12 +59,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.session_hosts.update( + async def test_session_hosts_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -60,12 +72,13 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): - response = self.client.session_hosts.list( + async def test_session_hosts_retry_provisioning(self, resource_group): + response = await self.client.session_hosts.retry_provisioning( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + 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 # ... 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 index 0f2cf1687abc..065c32db8173 100644 --- 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 @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_start_menu_items_list(self, resource_group): response = self.client.start_menu_items.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + 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 index 0cc0958c5005..d20b550871a2 100644 --- 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 @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_start_menu_items_list(self, resource_group): response = self.client.start_menu_items.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + 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 index 8b9a2c864beb..87db5499fe79 100644 --- 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 @@ -20,11 +20,12 @@ def setup_method(self, method): @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( + def test_user_sessions_list(self, resource_group): + response = self.client.user_sessions.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + session_host_name="str", + api_version="2024-08-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,13 +33,13 @@ def test_list_by_host_pool(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -46,13 +47,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -60,26 +61,27 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): - response = self.client.user_sessions.list( + def test_user_sessions_disconnect(self, resource_group): + response = self.client.user_sessions.disconnect( resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + user_session_id="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( + def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -87,14 +89,12 @@ def test_disconnect(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_send_message(self, resource_group): - response = self.client.user_sessions.send_message( + def test_user_sessions_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", - session_host_name="str", - user_session_id="str", - api_version="2024-04-03", + 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_user_sessions_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py index a03d5750b173..8dfe85b21db0 100644 --- 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 @@ -21,11 +21,12 @@ def setup_method(self, method): @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( + async def test_user_sessions_list(self, resource_group): + response = self.client.user_sessions.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + 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 @@ -33,13 +34,13 @@ async def test_list_by_host_pool(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -47,13 +48,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -61,26 +62,27 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): - response = self.client.user_sessions.list( + async def test_user_sessions_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", - api_version="2024-04-03", + user_session_id="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( + async def test_user_sessions_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-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -88,14 +90,12 @@ async def test_disconnect(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_send_message(self, resource_group): - response = await self.client.user_sessions.send_message( + async def test_user_sessions_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", - session_host_name="str", - user_session_id="str", - api_version="2024-04-03", + 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_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py index aee123acbae0..372bf8a8ca44 100644 --- 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 @@ -20,11 +20,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_workspaces_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workspaces_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_workspaces_get(self, resource_group): response = self.client.workspaces.get( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -32,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_workspaces_create_or_update(self, resource_group): response = self.client.workspaces.create_or_update( resource_group_name=resource_group.name, workspace_name="str", @@ -44,7 +65,12 @@ def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -52,16 +78,18 @@ def test_create_or_update(self, resource_group): "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", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -86,7 +114,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -94,23 +122,11 @@ def test_create_or_update(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_update(self, resource_group): + def test_workspaces_update(self, resource_group): response = self.client.workspaces.update( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -118,21 +134,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): - response = self.client.workspaces.list_by_resource_group( + def test_workspaces_delete(self, resource_group): + response = self.client.workspaces.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + 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_subscription(self, resource_group): - response = self.client.workspaces.list_by_subscription( - api_version="2024-04-03", - ) - 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 index dd1d71f33f85..1c5595dfdcff 100644 --- 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 @@ -21,11 +21,32 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_workspaces_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workspaces_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_workspaces_get(self, resource_group): response = await self.client.workspaces.get( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -33,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_workspaces_create_or_update(self, resource_group): response = await self.client.workspaces.create_or_update( resource_group_name=resource_group.name, workspace_name="str", @@ -45,7 +66,12 @@ async def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -53,16 +79,18 @@ async def test_create_or_update(self, resource_group): "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", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,7 +115,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -95,23 +123,11 @@ async def test_create_or_update(self, resource_group): @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-04-03", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_workspaces_update(self, resource_group): response = await self.client.workspaces.update( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-08-08-preview", ) # please add some check logic here by yourself @@ -119,21 +135,12 @@ async def test_update(self, resource_group): @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( + async def test_workspaces_delete(self, resource_group): + response = await self.client.workspaces.delete( resource_group_name=resource_group.name, - api_version="2024-04-03", + 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_subscription(self, resource_group): - response = self.client.workspaces.list_by_subscription( - api_version="2024-04-03", - ) - result = [r async for r in response] # please add some check logic here by yourself # ...